#web-development

2 messages · Page 95 of 1

marble carbon
#

take a look

#

Also I think Asana can do this as well, but it has a lot more features and can become confusing real quick, but that's just my opinion

sudden grail
#

Right, i get it. I like the kanban based things, but i can't get around this "finished" or "done" columns. Why are they even alive?

#

I have thought about making it visually nicer

#

more modern

#

because it was cool, but i think it's outdated

#

You cant see the list of subtask with the main task in kanban, you have to always open one..

marble carbon
#

I mean

#

they can eventually be archived for cleanup purposes

#

so that you only have the latest changes in them and the historical ones are archived

fickle fox
#

guys do you know how to save images as binary files in database??

marble carbon
#

I guess, it depends on your workflow and requirements

#

@fickle fox you shouldn't tho

#

which Framework ?

fickle fox
#

flask

#

and why not

sudden grail
#

I guess, it depends on your workflow and requirements
@marble carbon Yeah i know. I'm just trying to get a better overview of the market by asking ppl around

#

and why not
@fickle fox propably you should just store the file path in db

#

and the exact file on the server pc

#

or some 3rd api that gives you back the url

#

you store the url and get the files through it

marble carbon
#

no don't save file in db

#

it'll slow down your queries over time

#

save them on disk and just store the path in database

sudden grail
#

like i said 😛

marble carbon
#

ye I misread lmao

#

follow the guide it is good

fickle fox
#

hmm okii

#

thanks

marble carbon
#

@sudden grail how many people are in your team

#

Basecamp is better and more advanced than Trello tbh

#

that's more developer focused

#

I have usually seen devs ranting about Asana xD

sudden grail
#

@marble carbon iam alone. I just wanna make my own product but there are two ways of doing this. I want a simple solution, but useful. Like trello was in his ages

marble carbon
#

Hmm you see

sudden grail
#

I just want to get a small piece of the cake you know

marble carbon
#

to me Trello seems perfect because, when you have multiple tasks on your board

#

and you only display title, it's good and more focused, showing the details of each task might get overwhelming

#

there's also Github Projects now

#

but it has less features as compared to Trello

#

no comments on Tasks

#

no attachment etc

sudden grail
#

And what about monday?

marble carbon
#

I think it's similar to Asana, haven't got the chance to use it

#

it seems more focused on teams

sudden grail
#

And do you think there is place for improvement?

#

Can i dm you? 🤭

marble carbon
#

oh hmm there's no priority system in Trello tho, I do it instead with Labels and due date

#

Monday seems to have it

#

I mean if we keep the conversation here, others might be able to pitch in their experiences as well

#

in DM you might miss out on those insights

sudden grail
#

Yeah, but usually noone cares 🥺

#

But right

#

Priority system really missing🧐

haughty turtle
#

I am working on a Trello like system also, I mean I want to implement so new features so I dont think I would share, Gergo is looking to monetize any ideas that he sees are missing, to get a competitive edge over current competitors

marble carbon
#

Also no calendar view, but hey it's free, Monday has no free tier

haughty turtle
#

Point being I dont really share ideas publicly when its purpose is to be monetized.

marble carbon
#

Yeah it's alright

#

wait

#

@sudden grail are you planning to make a Trello like tool yourself?

#

I think I totally missed that part

haughty turtle
#

I just want to get a small piece of the cake you know
@sudden grail Yea

marble carbon
#

Oh hmm

sudden grail
#

@sudden grail are you planning to make a Trello like tool yourself?
@marble carbon yeah

marble carbon
#

lol then you should do all this research yourself xD

haughty turtle
#

He wants to milk you for his business ideas @marble carbon

#

😄

sudden grail
#

Thats why iam asking bro

marble carbon
#

idk, ig im too kind, I never understood the motive

#

oop

sudden grail
#

I try to better understand the market

haughty turtle
#

Eh but if you ask in a dev community any ideas you get would be like instantly worked on by others in here that find it interesting

marble carbon
#

yeah lol

#

what language do work with btw?

#

you*

sudden grail
#

Django in the back and react on front

marble carbon
#

lol okay

sudden grail
#

I just try to understand and figure out who are using calendar based tools and trello like apps

#

What are the personas

#

Or teams

marble carbon
#

this, and read discussions over forums such as Hacker news about task management tools

#

you'll be able to get an idea about the types of users

haughty turtle
#

The hard part is marketing though, especially with 0 funds...

marble carbon
#

Yeah, maybe producthunt, but it has to be visually pleasing to make a cut there ig

sudden grail
#

So it can be quite succesful if the marketing is good? @haughty turtle

tepid lark
#

give me trello with an audocad like cli

sudden grail
#

Yeah, maybe producthunt, but it has to be visually pleasing to make a cut there ig
@marble carbon yeah i visit this site often

tepid lark
#

it's weird, but I really like the fusion approach

sudden grail
#

🧐

marble carbon
#

Oh HA

tepid lark
#

i want to be able to drag or mv tiles*

marble carbon
#

we all get lifetime free plan, if it turns out to be product tho

sudden grail
#

Lool yeah

marble carbon
#

nitro gone

#

F

sudden grail
#

Ofcourse you get @marble carbon

marble carbon
#

is my pfp still moving

tepid lark
#

gif privileges revoked

marble carbon
#

gone??

tepid lark
#

maybe it's just me

marble carbon
#

i can still see it moving

#

imma restart again ig

native tide
#
auth_views.LoginView.as_view(template_name='users/login.html')```

When pointing to my template w/ template_name, CSS isn't picked up (but with return render() within a view it is). Does anyone know how to fix this?
haughty turtle
#

o.o you can pass in template_name directly into as_view()

#

did not know that, where is your model at @native tide

native tide
#

my model?

haughty turtle
#

are you using django?

native tide
#

yea

#

my css file? my html file?

#

I don't understand what you mean by that. I'm new sorry

haughty turtle
#

Are you not passing in a object from a Model?

native tide
#

no...

#

Is it possible to filter down an html table that is populated from a database using a dropdown menu with values from the database as well? I've been using flask for this project with the front end being formatted with assistance from wtforms.

native tide
#

probably w React and some APIs

haughty turtle
#

in your views are you importing from django.views import generic? @native tide

#

As before you where using render from django.shortcuts but now you switched to a generic call

native tide
#

no I'm trying to implement it into urls

#

instead of using my own view

haughty turtle
#

well wherever you are using it import generic from django.views

#

are you are trying to use a generic template from django

#

instead of rendering

#

also when I followed Django tuts it calls template name inside of views. @native tide but if you are going to use it inside of urls you still have to import generic still I would imagine

#

also why did you import render into urls if you are not using render o.o

#

@native tide

native tide
#

I was just trying render to see if it would do anything, but it didn't.

#

I'll read into django.views import generic, can you explain what it does?

haughty turtle
#

of course wont do anything if you arent calling render, but why are you trying to render directly from urls, I wouldnt recommend it

#

how would you handle any errors needed

#

import generic is just a even shorter version of using render.

native tide
#

no I'm not trying to use render, I was just experimenting

#

I'm trying to use auth_views.LoginView.as_view but I can't get the CSS loaded through it

#

but if I use a view with render(template-name) the CSS is loaded

haughty turtle
#

this is inside of views

#
from django.views import generic
class DetailView(generic.DetailView):
    model = Question
    template_name = 'polls/detail.html'``` this is how my view looks inside of Django
native tide
#

Ok. So since LoginView is predefined, can I customize it?

haughty turtle
#

LoginView is supposed to reference a class in your views

#

such as DetailView, that is what your LoginView should represent @native tide

native tide
#

Oh I didn't know

haughty turtle
#

But what tut are you following, o.o

#

You should not be that lost.

#

Lol I just got into the generic views part of Django like literally 2 hrs ago, and here I am helping you right away

native tide
#

So in my views I need to make the class LoginView?

#

I was following Corey Shafer

haughty turtle
#

Yeah create the class LoginView

#

The Django tut on the Django website is pretty straight forward.

#

I am watching some of the NewBoston Django vid, but not coding while watching as I see how he builds the song playlist app.

#

Just to see how he works passing in real data to Django, but other then that you should get used to reading from documentations

#

@native tide it will make your life much easier

#

what does Corey Shafer build in his tut

native tide
#

Some sort of social media app

#

But thanks I think I'm just gonna follow django tut

#

and using the parts that I want for my own projects instead of following others

haughty turtle
#

yea, if you want then watch Corey Shafer afterwards but not code just watch how he implements the social media part into django

#

@native tide

wild thunder
#

guys, any tips on how to receive post requests?

#

i'm using flask, the post request happens, but when i print the request, returns None

#

i'm using postman to test

grizzled sand
#

Hello guys, could you explain please, difference between this types of declarations namespaces for urls?
First one we define app_name first, in second one we dont, but using include() with extra str ` app name'

First declaration

# blog/urls.py

app_name = 'blog'

urlpatterns = [
 # post views
 path('', views.post_list, name='post_list'),
 path('<int:year>/<int:month>/<int:day>/<slug:post>/',
 views.post_detail,
 name='post_detail'),
]

#urls.py root
urlpatterns = [
 path('admin/', admin.site.urls),
 path('blog/', include('blog.urls', namespace='blog')),
]

Second declaration

# blog/urls.py
urlpatterns = [
 # post views
 path('', views.post_list, name='post_list'),
 path('<int:year>/<int:month>/<int:day>/<slug:post>/',
 views.post_detail,
 name='post_detail'),
]

# urls.py
urlpatterns = [
 path('admin/', admin.site.urls),
 path('blog/', include(('blog.urls', 'blog'), namespace='blog'),
]
haughty turtle
#

@grizzled sand in the second declaration you are declaring the app name in the include, unlike in declaration 1 where you declared it in the blog url.py

#

"include()
include(module, namespace=None)
include(pattern_list)
include((pattern_list, app_namespace), namespace=None)
A function that takes a full Python import path to another URLconf module that should be “included” in this place. Optionally, the application namespace and instance namespace where the entries will be included into can also be specified."

native tide
#

How can i get the url path by its name...like

path("some-pattern/", views.someview, name="Log-In")

In this...i want the url pattern by name Log-In

native tide
#

Found it! Nvm

proud meteor
#

hello

#

anyone can help me in MERN?

tepid lark
#

@proud meteor what's your issue?

fierce hare
#

Can someone help me with this, i have no clue why im getting this now.

versed python
#

looks fine to me.

#

all packages are up to date in your node_modules

bold mantle
#

Hey guys, I've recently started learning Graphene, I was trying an example to have Enum as field argument but cannot get it work. I've looked into Graphene Enum documentation but it's not helpful. Here is the example code - https://paste.pythondiscord.com/idoyifimip.py

While executing the code, I'm getting following error -
data: {'errors': [{'message': 'Object of type EnumMeta is not JSON serializable'}]}

glad patrol
#

hi i need help

#

i need to get the total number of connected clients using flask-scoketio
i write this code
clients = []
socketio = SocketIO(app)
@socketio.on('connect', namespace='/test')
def connect():
clients.append(request.namespace)

@socketio.on('disconnect', namespace='/test')
def disconnect():
clients.remove(request.namespace)

#

then i render this

return render_template_string(TABLE_TEMPLATE, data=data, clients=len(clients))

in html part i display like this
<h1>{{ clients }} </h1>
but it keep showing 0 on web page even the client is connect it should be 1 2 depend how many client are connected

can someone help

uneven radish
#

Hi,

I am learning Django and how to handle API calls. I'm using https://rickandmortyapi.com/ Rick and Morty API to work with.
I'm building the characters page first. You can visit it here: https://rickandmortyapi.com/api/character/
I am able to make a call, get the response and display it on the webpage.

As every page has only 20 records, I want to have a link at the bottom of the first page to call https://rickandmortyapi.com/api/character/?page=2 this URL. The next and prev pages URLs are there in every API call so it is easy.

Now instead of displaying contents from an external API server, I want to render this next page onto my website. I have linked the above to an anchor tag in HTML and it is redirecting it to the external API as it should be. How can make a call to external API, and still render everything on my website?

The Rick and Morty API

The Rick and Morty API is a REST and GraphQL API based on the television show Rick and Morty

glad patrol
#

any1 avialble

#

i need help

outer pier
#

if I used LoginView how to restrict the user to perform a specific task ?

#

@glad patrol pls ask ... if i can I will definitely help

glad patrol
#

thanak you for help

#

i have this problem

#

i need to display the number of connected clients on web page i am using flask-socketio and i write this code for checking connected and disconnected connections.

#
app = Flask(__name__)
socketio = SocketIO(app)
clients = []

@socketio.on('connect', namespace='/')
def connect():
    clients.append(request.namespace)

@socketio.on('disconnect', namespace='/')
def disconnect():
    clients.remove(request.namespace)```
#

then i render template like this

return render_template_string(TABLE_TEMPLATE, data=data, clients=len(clients))

#

In html part i call like this

<h1>{{ clients }} </h1>

#

but on webpage it keep showing 0 even client is connect i get output from client and it is connected it should print 1 2 depends how many clients are connected. even if i print this print(len(clients)) it return 0.

outer pier
#

sorry bro ... I am kinda django user...

glad patrol
#

oh

uneven radish
#

if I used LoginView how to restrict the user to perform a specific task ?
@outer pier
LoginRequiredMixin.

#

This may help to authenticate if user is logged in or not.

outer pier
#

@uneven radish thanq for your help...

#

is there any way to display image on django admin site

uneven radish
#

UserPassesTestMixin

Also check this. It enable you to check if user is performing certain actions on his/her created/modified items which are associated with his/her user ID.

#

is there any way to display image on django admin site
@outer pier I don't know about that.

outer pier
#

definitely sir .... thank you for your valuable time

uneven radish
#

No problem.

glad patrol
#

any1 know flask

glossy arrow
#

Im making a website with flask, but when I link the bootstrap stylesheet, it wont work

outer pier
#

@glad patrol did you made sure your socket was connected

native tide
#

@glossy arrow what won't work?

glossy arrow
#

@native tide Yeah, nvm I got it to work

outer pier
#

is it the best practice to add image to django admin site or create a separate view to django staff admins so that they can verify the images from users ?

peak thorn
#

I am learning Flask with SQLite3 and following the Flaskr tutorial. How can I migrate my existing SQLite3 tables to SQLAlchemy?

#

I am trying to change column data type

glad patrol
#

@outer pier yes

proven orchid
#

how to pass down this.state from class to another class as a prop in a different file with react?

#

ping me up if anyone knows

#

Can anyone help me?

glad patrol
#

@outer pier not worked

#

any 1 know flask

outer pier
#

i m sorry that was js code...

#

i think someone with better knowledge will help...

glad patrol
#

ya

past cipher
#

So I'm wondering how to approach this. I have 2 different routes. Buyer and Seller. I want them both to have access to /dashboard. And /dashboard should either render seller-dashboard.html or buyer-dashboard.html based off their user role. However, I can't have two routes called /dashboard. How can I achieve this

marble carbon
#

inside your view

#

check if authenticated user is buyer or seller

past cipher
#

but buyer/seller is two diff routes

marble carbon
#

huh

#

show code

#

for urls and views then

past cipher
#

I am using Blueprints

#

one for seller

#

one for buyer

#

buyer_bp.route

#

seller_bp.route

marble carbon
#

uh flask

#

?

past cipher
#

yh

#

I think I'm just going to use b/dashboard and s/dashboard to indicate which dash it is

marble carbon
#

i mean

#

how about a redirect

#

to those routes

#

based on type or user?

#

of*

past cipher
#

because the issue is I don't have 1 routes file. I have 2 seperate, one for buyer and one for seller. So i need dashboard in each of them

tepid lark
#

have a third dashboard blueprint and redirect to that?

nimble epoch
#

Which one is better flask_mail or flask_emails or no difference?

twilit dagger
#

In Django is there a way to check if the user is an admin???

#

like you have {% if user.is_authenticated %} and LoginRequiredMixin

#

But for admin users

#

Is it the same

marble carbon
#

user.is_staff

#

or is_superuser

#

i think lemme check

hearty bloom
#

Can anyone suggest flask Api Course

#

Much needed

solemn thistle
woven gazelle
#

i want to make my footer look like google homepage footer
but i dont know hoe to go about it to make it look like google homepage footer

zealous siren
#

Harsh Mangal, instead of Flask API, look into FastAPI

glad patrol
#

i need help regarding flask

dreamy wadi
#

is anyone familiar with proc files and uploading web applications to heroku with git?

#

i keep getting an error telling me that my procfile isnt working even though its in the right directory and I used multiple sources to figure out the format of said procfile

solar ridge
#
class MyForm(forms.Form):
  # stuff
  class Meta:
    widgets = {
      'date_due': {'class': 'changed-class', 'type': 'date'}
}

This is the better method if you're not doing any special stuff in the __init__ method. @solar ridge
@versed python

#

I seem to get a AttributeError: 'dict' object has no attribute 'is_required' ?

#

Did you come across this as well?

#

Or does anyone else know how to modify the "type" attribute of a widget from the Form class?

wet heath
#

Hey folks. I wanted to know is it possible to use Webpack with Django and Python? And how hard is it if that’s possible?

solar ridge
#

I've already read that documentation before which doesn't seem to work as expected. Following those guidlines I can set the date type, however if I visit the form from say an UpdateView which has prepopulated data from a model, then the date input does not retain that information, and instead shows a blank date input field

#

I'm starting to lean on the idea this is a bug in Django, setting the "type" attribute doesn't change a DateTime model input field. Overriding the input_type from the inherited TextInput widget (django\forms\widgets.py) changes the attribute, but does not populate the field with the original model data when in an update view

#

The only solution I have been able to make is using ```python
self.fields.get('date_due').widget = forms.TextInput(
attrs={'type': 'date'}
)

#

and that's inside the Form init

#

At some point between modifying the type input and rendering, the original value of the field is not converted.

twilit dagger
#

@dreamy wadi 90% of the problems with Procfiles are with the directory

wanton ridge
#

this is my bottle framework and on the picture i started the localhost:8080 and i want it the same look as the right picture

twilit dagger
#

@wanton ridge put the form inside a parent div then set the parent div's background image

wanton ridge
#

so mean before the form i create a div and put the background inside?

twilit dagger
#

Don't put the background inside put it as background-image in CSS

wanton ridge
#

do u know how do i put my css in bottle? with the login.html?

twilit dagger
#

But it's not possible to do without CSS

wanton ridge
#

i know

#

so i have to put something inside my form.css?

twilit dagger
#

I haven't used Bottle a lot before

wanton ridge
#

ok

twilit dagger
#

Or you can just use inline-css

wanton ridge
#

i will see what i can do

#

if any question i will ask you

wet heath
#

Hey guys. I wanted to know is it possible to use Webpack with Django and Python? And how hard is it if that’s possible?

past cipher
#

Lets say I have two tables

class User():
  id = db.column(db.Integer, primary_key=True)
  task = db.column(db.String(20), nullable=False)
  address = db.relationship('address')

class Address():
   id = db.column(db.Integer, primary_key=True)
   attempt = db.column(db.String(50), db.ForeignKey('user.task')

Now inside my route I pass through a query like:

return render_template('test.html', usr=User.query.filter_by(id=12).first())

Can I not access the address table because I setup up a relationship?

#

instead of having to also query the address table separately

marble carbon
#

@wet heath there's a package django-webpack or smth, that might help, I have seen it but never used it, you could give it a try

cunning falcon
#
@bot.command()
async def lyrics(ctx, *, song):
    driver = selenium.webdriver.Chrome("C:\Program Files (x86)\chromedriver.exe")
    driver.get("https://genius.com/")
    search_song = driver.find_element_by_name("q")
    search_song.send_keys(song)
    search_song.send_keys(Keys.RETURN)
    
    search_lyrics = driver.find_element_by_class_name("mini_card")

this is my code
when i go to genius.com and search for a song it works fine but when i wanna get the element by class name called mini_card in top result section it gives an error that it cant find any element

cyan hollow
#

try using beautifulsoup instead

cunning falcon
#

no

#

i find selenium comfortable

cyan hollow
#

selenium is only used for browser automation. If you use something like BeautifulSoup it will be less memory intensive

cunning falcon
#

but can you help me in this?

#

i dont wanna go to beautifulsoup

nova crest
#

Hello everyone,

I have a Flask app that's running on Heroku. It currently uses Global variables to reference data across views and functions. I want to get rid of Global variables and use a database instead.
The data won't be stored permanently. It's only necessary while my web-app does its thing.

Do you have any tips on how to go about this? Should I just make a single database with all 34 Global variables?

cyan hollow
#

did u try find_elements_by_class_name Arush?

cunning falcon
#

yes

#

i did

#

i did by_class_name("mini_card")

#

but still got errors

#
<a ng-href="https://genius.com/Dj-snake-let-me-love-you-lyrics" class="mini_card" ng-class="{'mini_card--small': $ctrl.variants.small}" href="https://genius.com/Dj-snake-let-me-love-you-lyrics">
  <div class="mini_card-thumbnail clipped_background_image--background_fill clipped_background_image" clipped-background-image=":: $ctrl.song.song_art_image_thumbnail_url" style="background-image: url(&quot;https://t2.genius.com/unsafe/93x93/https%3A%2F%2Fimages.genius.com%2F073cd0dbdf330c416680c3705d09270a.300x300x1.jpg&quot;);">
    <!---->
  </div>
  <div class="mini_card-info">
    <div class="mini_card-title_and_subtitle">
      <div class="mini_card-title">Let Me Love You</div>
      <div class="mini_card-subtitle">
        DJ Snake<!---->
      </div>
    </div>
    <!---->
    <!----><div ng-if="!$ctrl.excerpt_with_markup">
      <!----><div ng-if="$ctrl.song.lyrics_state === 'complete'" class="mini_card-metadata">
        <!---->
        <!---->
        <!----><span ng-if=":: $ctrl.song.stats.pageviews">
          <svg src="eye.svg" class="inline_icon inline_icon--up_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 15.45"><path d="M11 2c4 0 7.26 3.85 8.6 5.72-1.34 1.87-4.6 5.73-8.6 5.73S3.74 9.61 2.4 7.73C3.74 5.86 7 2 11 2m0-2C4.45 0 0 7.73 0 7.73s4.45 7.73 11 7.73 11-7.73 11-7.73S17.55 0 11 0z"></path><path d="M11 5a2.73 2.73 0 1 1-2.73 2.73A2.73 2.73 0 0 1 11 5m0-2a4.73 4.73 0 1 0 4.73 4.73A4.73 4.73 0 0 0 11 3z"></path></svg>
          3.3M
        </span><!---->
        <!---->
      </div><!---->
      <!---->
      <!---->
    </div><!---->
  </div>
</a>```
#

this is the html code of element i wanna access

cyan hollow
#

u didnt do find_elements?

cunning falcon
#

huh?

#

im new to selenium

#

how do i do that?

cyan hollow
#

driver.find_elements_by_class_name("mini_card-info")

cunning falcon
#

ok

#

lemme try

cyan hollow
#

it should return a bunch of div's

cunning falcon
#

should i print it?

#

but i wanna click that box (element)

jolly elm
#

Guys, why do I do a search and do the paging of this search occurs this error?

#

???

cyan hollow
#

print it first

#

see if u even have the correct thing arush

cunning falcon
#

@cyan hollow i defined that line with a variable called lyrics then when i did print(lyrics) it returned []

cyan hollow
#

ok im not quite sure then

cunning falcon
#

uh

cyan hollow
#

I havent used selenium in a long time

cunning falcon
#

oh

cyan hollow
#

Best bet is to ask someone else in one of the help channels

cunning falcon
#

(no one answers)

cyan hollow
#

try googling it then

cunning falcon
#

but its (genius prob)

#

idk if my code has error or their html is trash

lethal orbit
#

Do you have any tips on how to go about this? Should I just make a single database with all 34 Global variables?
@nova crest use redis, maybe. In-memory key-value store, would be faster than a full-fledged DB like SQL.

nova crest
#

@lethal orbit Interesting. Do you know where I can find documentation or a tutorial on Redis?

#

I've been googling it, but I'm not sure what I should be looking for

cunning falcon
#

someone help me

#

(scroll up for my problem)

lethal orbit
uneven radish
#

Hi All,

Django related question.
I am making a call to an API, fetching the data and displaying it on the webpage.
Should I directly display it or fill it in database and display from my model?

What is more optimum way of doing this?

nova crest
#

oh, that looks fancy!

lethal orbit
#

I first read about it in 7 databases in 7 weeks

#

Not sure if you can do their course in a day instead of 6 weeks lol

nova crest
#

Fair point hahaha

#

I'll check it out

lethal orbit
nova crest
#

oh right, thanks!

marble carbon
#

ayo

#

is that book good patryk?

#

I bought it but didnt read it yet

uneven radish
#

@cunning falcon What is your final goal here? What are you trying to build?

lethal orbit
#

It's great. Doesn't go into details much, but it spends 3 days on each DB explaining the basics.

marble carbon
#

so at the end, i'll be able to walk away with information about where to use each kind of database 🤔?

lethal orbit
#

Yeah. Gives a decent overview.

cunning falcon
#

@cunning falcon What is your final goal here? What are you trying to build?
@uneven radish when i search for a song there at that website, in top result there is a box, so when i inspect it, i get class_name as mini_card so when i try accessing that element by clicking it, it get error that there's no element with that class

lethal orbit
#

Introduces you to Graph Databases, NoSQL, etc.

#

(Probably better to discuss in #databases also lol)

marble carbon
#

yeah alright

uneven radish
#

@cunning falcon Can you send me the link please, I'll look into it.

cunning falcon
#

ok

#

here

uneven radish
#

You are clicking the top result?

cunning falcon
#

no

#

the box under top result

uneven radish
cunning falcon
#

no

#

there is a box under the heading top result

#

^^

uneven radish
#

This?

cunning falcon
#

no

#

in right lane, the first song

#

this

#

the highlighted

uneven radish
#

This is Top Result right?

cunning falcon
#

yes

uneven radish
#

Okay.

cunning falcon
#

@uneven radish so how to fix the prob?

uneven radish
#

I'm checking.

cunning falcon
#

ok

uneven radish
#

Have you tried get_element_by_class_name? And extracted its a href?

cunning falcon
#

when i do get_ele_by_class_name i get error that no class found

cunning falcon
#

@uneven radish u here?

haughty turtle
#

@cunning falcon dude you need songs = soup.find_all('div', class_='mini_card-info')

#

now then even so your going to need to identify the sections ng-repeat="section in $ctrl.sections"

blazing jetty
#

I'm trying to use flask restful to make it so that I can do a GET request, how do I get the url parameters?

haughty turtle
#

This is where its broken up into top results, songs, lyrics @cunning falcon

blazing jetty
#

google gave me so many different answers I decided to ask here

haughty turtle
#

then your going to need to loop through those sections and if the section title is not songs then continue

cunning falcon
#

@haughty turtle im not using beautifulsoup!

haughty turtle
#

then what are you using.

cunning falcon
#

selenium

#

@uneven radish

haughty turtle
#

songs = driver.find_element_by_xpath("//div[@class='mini_card-info']")

cunning falcon
#

ok

haughty turtle
#

and stop pinging people multiple times if they dont answer their busy its annoying.

cunning falcon
#

ok sry

#

the element u gave is clickable?

haughty turtle
#

no

#

because you then have to get the href from it

cunning falcon
#

how to get its href?

#

im new to selenium

haughty turtle
#

Have you followed any tuts

cunning falcon
#

yes

#

tech with tim

#

i just followed the basics

#

@haughty turtle how to extract href from it?

haughty turtle
#

check if that class is clickable

cunning falcon
#

how to check?

haughty turtle
#

by trying to click it.

#

Is this even a selenium help channel. Do not see how this is web-development related

cunning falcon
#

NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//div[@class='mini_card-info']"}

#

i cant even go to that element

#

@haughty turtle

haughty turtle
#

open a help channel and ping me

cunning falcon
#

ok

haughty turtle
#

this is taking to much space here.

cunning falcon
#

k

abstract kite
#

ay guys, i cant find information on how to use OrderingFilter from django rest framework inside ModelViewSet @visual pivottion, does anyone know how would i implement that?
@glacial night you just have to import (from rest_framework.filters import OrderingFilter) and add these 2 variables in the class based view

filter_backends = [OrderingFilter]
ordering = ['column name']
#

@glacial night where are you getting ModelViewSet from?

#

basically inheriting the class right ?
so its a class based view

#

decorators ? they dont work on classes

#

can you post your code here

#

oh ok i thought you were directly trying to order the viewset output, not sure about this though

#

@glacial night how about adding the ordering in the product serializer itself ?

tropic drum
#

why does my iframe have a scroll bar??

#

html

abstract kite
#

@glacial night should it be dynamic or always ordered by a particular columns ?

nova crest
#

In my Flask app, I have multiple global list variables, such as:

location = ['address 1', 'address 2', etc]
appointmentTime = ['time 1', 'time 2', ect]

The values in the list are user-specific.
I want to replace these global variables with a database. Is it possible to put these list variables in one database?
So, I'd have 1 column for user_id, a column for location and a column for appointmentTime.

#

oops, wrong channel

abstract kite
#

@glacial night sorry not sure about how to do that
i would like to try this hacky solution, order the query set with .order_by('column_name'). replace the column_name string from the request data 😅

wanton ridge
vague island
#

which framework should I choose for serious webapp backend devlopment which can handle heavy traffic as if i will be building backend for facebook , netflix etc?
Django(python) or Express(Nodejs) or somthing else

tame canopy
#

Hello guys, I want to know which module should I see to build an API with Flask, Flask Restful or Flask RestPlus

wanton ridge
#

@glacial night i changed to this but still doesn't work

#

i wanna get the html code to bottle and after i starte the server in localhost it should be there my html code

#

also the html is in the same file

vague island
#

@glacial night What do yo u think about the MERN stack ? recently i am getting attracted towards it.

hidden mantle
#

py pipenv install flask flask-sqlalchemy flask-cors when i type this into cmd it doesnt work, and ideas why?

vague island
#

so u use the R with Django ?

glad patrol
#

hi i need help

hidden mantle
#

@hidden mantle did you try without "py"?
@glacial night yeah

wanton ridge
glad patrol
#

how to get total number of connected clients in flask

hidden mantle
#

then it says that it coudnt fint the command pipenv

glad patrol
#

i have client and fllask app

#

i need to get number of connected clients

snow estuary
#

hello any one could help me build my cart page ?

#

django

glad patrol
#

@glacial night how to get total client conencted to flask app

wanton ridge
#

@glacial night so i have to create @route('/', method='get') right?

#

tyy

glad patrol
#

like this is my code

#

no no

#
import requests
import subprocess, string, time
import os

url = 'http://127.0.0.1:5000/'
name = os.uname()[1]

def on_device_add():
    requests.post(f'{url}/device_add?name={name}')
def on_device_remove():
    requests.post(f'{url}/device_remove?name={name}')

def detect_device(previous):
    total = subprocess.run('lsblk | grep disk | wc -l', shell=True, stdout=subprocess.PIPE).stdout
    time.sleep(3)

    # if condition if new device add
    if total > previous:
        on_device_add()
    # if no new device add or remove
    elif total == previous:
        detect_device(previous)
    # if device remove
    else:
        on_device_remove()
    # Infinite loop to keep client running.


while True:
    detect_device(subprocess.run(' lsblk | grep disk | wc -l', shell=True , stdout=subprocess.PIPE).stdout)
#

this is my client side code

#

when i run my flask app

#

then i run this client code

#

which display if client connect usb or not

#

i need to get this how many clients are running

#

this is my basic flask app

#
from flask import Flask, request, render_template_string

app = Flask(__name__)


TABLE_TEMPLATE = """

<style>
   table, th, td {
   border: 1px solid black;
   }
</style>
<table style="width: 100%">
   <thead>
      <th>Client</th>
      <th>IP</th>
      <th>Status</th>
   </thead>
   <tbody>
      {% for row in data %}
      <tr>
         <td><center>{{ row.client }}</td></center>
         <td><center>{{ row.ip }}</td></center>
         <td><center>{{ row.status }}</td></center>
      </tr>
      {% endfor %}
   </tbody>
</table>
"""


@app.route("/device_add", methods=['POST'])
def device_add():

    name = request.args.get('name')
    with open('logs.log', 'a') as f:
        f.write(f'{name} Connected USB from IP: {request.remote_addr} \n')
    return 'ok'


@app.route("/device_remove", methods=['POST'])
def device_remove():

    name = request.args.get('name')
    with open('logs.log', 'a') as f:
        f.write(f'{name} Disconnected USB from IP: {request.remote_addr}\n')

    return 'ok'


@app.route("/", methods=['GET'])
def device_list():
    keys = ['client', 'ip', 'status']
    data = []
    with open('logs.log', 'r') as f:
        for line in f:
            row = line.split()
            data.append(dict(zip(keys, [row[0], row[-1], row[1]])))


    return render_template_string(TABLE_TEMPLATE, data=data)


if __name__ == "__main__":
  app.run(app, threaded=True)```
#

so on this flask app i need to display how many clients are running right now

#

not this how much views

#

not viewing page

#

see first i run my flask app

#

ok

#

then i run client code means 1 client connect to my appp

#

and it keep sending info

#

if i stop client code then 0 client is connected

#

i guess some counter stuff work but idk where to put it

#

yes i try flask-scoketio but it display views

hidden mantle
#

it is exactly the same code

haughty turtle
#

@native tide just posted about https://brython.info/ in general, wanting to know if anyone has used it, seems interesting, a python replacement of javascript

mortal sentinel
#

can someone help me with this

lethal orbit
#

can someone help me with this
@mortal sentinel fix your json file.

mortal sentinel
#

how ?

lethal orbit
#

Check the debug log.

#

This error doesn't really tell us anything.

mortal sentinel
#

okay

native tide
#

I was looking at brython a little more closely @haughty turtle
It relies on a Javascript library, brython.min.js so to be honest I'm skeptical that its a realistic solution. That being said, if they advance it, it cant be any more insane than any of the rest of the front end frameworks. But it cant be actual python.

If anyone has more experience than the last 30 minutes of me looking at it, Im interested as well.

#

I'm running a uvicorn api, on local host it works perfectly yet when I try to connect to it it doesn't work, port forwarding is enabled

haughty turtle
#

Yeah I mean as it's not massly adopted I imagine they have to build it on top of js in the meantime @native tide

#

But has potential

native tide
#

I'm interested in knowing if its using an actual python interpretter. But I havent had time to investigate it a lot. I think its a cool idea though as well.

#

I do recall that at one point gdude said to someone asking if client side python was possible, something to the effect of... 'Technically yes, but its not a good idea'

#

I didnt understand what he meant then, but he might know more. I imagine this is what he was talking about

obtuse kite
#

i want to start a django app within my django project but it is giving me an error as i type the code in vsc builtin terminal which is phyton manage.py startapp name
phyton : The term 'phyton' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1

  • phyton manage.py startapp blog
  • ~~
    • CategoryInfo : ObjectNotFound: (phyton:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException
      this is the error
native tide
#

spell it python

obtuse kite
#

isn't it phyton😂

#

omg

native tide
#

it happens 😛

obtuse kite
#

how dumb i am

#

python manage.py startapp blog
C:\Users\Ali Hasnain\AppData\Local\Programs\Python\Python38-32\python.exe: can't open file 'manage.py': [Errno 2] No such file or directory

#

now it giving this error

native tide
#

try to to cd C:\path\to\project and then try again

#

im not super good at Windows command line but it sounds like you're not in the right folder.

obtuse kite
#

i mean my project is in this directory

#

so we cannot have app here

#

it is not making sense

native tide
#

Django project structure is the most confusing thing about django.

#

If you have not done it yet i recommend doing the practice polls app on their documentation

obtuse kite
#

and also cannot understand properly the c directory thing u told

native tide
#

Because it explains the confusing waay of it.

obtuse kite
#

@native tide can i start a call with u if u don't mind?

#

maybe just screen sharing

native tide
#

No, Im afraaid i do not have time for that. Sorry.

obtuse kite
#

np

#

i mean most confusing thing about frameworks is starting a project but it is a one time effort

native tide
#

If you dont learn the very strict project structure it only gets worse as it gets bigger.

stable kite
#

@obtuse kite are you on windows

native tide
#

Things should be very exactly where they go and its not intuitive.

obtuse kite
#

@obtuse kite are you on windows
@stable kite yes sir

#

If you dont learn the very strict project structure it only gets worse as it gets bigger.
@native tide that's why i stopped my tutrioal and learning it first

stable kite
#

just type ls in powershell & check if it has manage.py

obtuse kite
#

just type ls in powershell & check if it has manage.py
@stable kite is it 1s or Is?

stable kite
#

it is 'ls'

#

not '1s'

obtuse kite
#

just i have to type Is without any suffix or preffix sorry if it get u annoyed

stable kite
#

it is just ls

marble carbon
#

LS but small

stable kite
#

you dont have to type any suffix or prefix

native tide
#
[projectname]/
├── [projectname]/
│   ├── __init__.py
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
└── manage.py

Its confusing becaause if you're following the default structure you will have something like this

#

you have a project folder inside of a project folder

#

You have to be in the outer project folder

#

The reason why it is like this is easier for you to just read

#

But its confusing at first

obtuse kite
#

Directory: E:\phyton programming

Mode LastWriteTime Length Name


d----- 05/10/2020 21:01 hypernovaa
d----- 22/09/2020 22:40 Project Hypernova
-a---- 11/09/2020 01:08 381 Classes and instances.py
-a---- 11/09/2020 00:46 79 ok.py
-a---- 01/09/2020 00:32 81 super.py
-a---- 29/08/2020 16:42 406 test.py

#

it gives me this

#

hypernova is the name of django project

stable kite
#

so just type cd hypernovaa

#

and then ls

obtuse kite
#

it worked thank you so much for your time

#

i really appreciate the help

stable kite
#

no problem

native tide
#

yeah the cd means "change directory"

stable kite
#

yes

obtuse kite
#

cd makes u kind of enter like open a folder

#

am i right?

#

this is the stuff u learn with time

#

I am not too old

#

just 2 months

stable kite
#

ya somewhat yes it allows you to access the stuff inside the folder in terminal

native tide
#

yeah Django is pretty hard as a first project so dont get upset if it seems like a lot when you get into it

obtuse kite
#

yeah true it is the first (hard) step

#

thanks to both of u guys again

quaint flower
#

Where is the cgibin in apache2 running on raspberry pi 4?

haughty turtle
#

@native tide yeah I imagine so, as it's client sided it would have to have built in functionality with all major browsers

#

Eh still diving into JS now but I imagine this is what the problem would be

past cipher
#

Lets say I have two tables

class User():
  id = db.column(db.Integer, primary_key=True)
  task = db.column(db.String(20), nullable=False)
  address = db.relationship('address')

class Address():
   id = db.column(db.Integer, primary_key=True)
   attempt = db.column(db.String(50), db.ForeignKey('user.task')

Now inside my route I pass through a query like:

return render_template('test.html', usr=User.query.filter_by(id=12).first())

Can I not access the address table because I setup up a relationship?

native tide
#

what is your error @past cipher ?

past cipher
#

i don't have an error

#

i'm asking a question

haughty turtle
#

Pssh JS is si simple, similar to Python I mean once you know python you can learn any language easily

versed python
#

Do you know C?

dense slate
#

JS might be simple, but the syntax is awful.

errant junco
#

Can anyone here help me out on #help-carrot it's about django rest api

tepid lark
#

has anyone integrated python social auth with Shibboleth?

#

I assume it should work with any SAML IdP

topaz widget
#

Hi friendly people, I have a Django website that has a different name locally than on my server. Thus far, any time I have done recursive copies of the entire website onto the server, I have gone into the files and changed all references to the name by hand, but this is pretty tedious. I could write a script to do this, but that might take a little time to get right. Does anyone know of any pre-built tools to recursively search through all the files in a directory and replace a string (or substring) with another pattern?

vapid acorn
#

I dont know how to add extra data to post requests

#

apart from the value

solid sun
#

Hey! I have a begginer question about Django. I think the easier for me to explain it is to show my code, here's what I got in my urls.py:

    path('<slug:slug>/', views.LanguageDetailView.as_view(), name='languagedetail'),
    path('<slug:slug>/', views.DomainDetailView.as_view(), name='domaindetail'),

And in my Views:

class LanguageDetailView(generic.DetailView):
    model = Language
    slug_field = 'slug'


class DomainDetailView(generic.DetailView):
    model = Domain
    slug_field = 'slug'

So the idea is that if it doesn't find any Language model with that slug, instead of showing a 404 error it searches a Domain model with that slug and show it (and then if it doesn't find one, throw a 404). Obviously right now it doesn't work for the second part, if it doesn't find a Language it throws a 404 error withour searching for a Domain. I would like to know what is the cleanest and better way of doing it. (I tried to do that by overwriting the get method in LanguageDetailView but that didn't work well and doesn't seem to be a clean way of doing it at all)

ionic rover
#

Hi everyone! New user here! Quick question that I don't need a whole channel for: are there any free (or very cheap) hosts that allow me to deploy flask working on postgresql?

wicked axle
#

Hey Guys im trying to build a basic python program that gathers information from instagram using the JSON data from instagram. the data right now tho is a bit hard to read. do any of you guys know any way to make the JSON data more readable? The link i am using is: https://www.instagram.com/account_name/?__a=1 where "account_name" is the profile i am scraping.

solid sun
#

You mean human-readable? I use the JSON Formatter chrome extension for that and it does a wonderful job at beautifing json files

#

@wicked axle

wicked axle
#

thanks

#

i just got it and it works great

marble carbon
#

hi grizzly

wicked axle
#

👋

bronze blaze
#

good afternoon

vapid acorn
#

good night, my friend

bronze blaze
#

is this the right chat to ask about django and flask?

vapid acorn
#

yeah

#

I think thats web-dev

bronze blaze
#

great, thank you very much 🙂

marble carbon
#

that was all?

#

you don't have a question? yert

bronze blaze
#

I already made my question, for now I don't have more questions yet

#

but I will ask again soon, because I'm interested in django and flask

marble carbon
#

haha good luck, feel free to drop by

bronze blaze
#

well, now I have a question

vapid acorn
#

ok

dense slate
#

@ionic rover DigitalOcean

bronze blaze
#

does anybody know good book that teaches flask with python 3?

dense slate
#

$5 for a basic box/server.

#

@bronze blaze Have you looked at the basic tutorials online?

#

They're usually quite comprehensive.

#

I know more of the Django sources, but I'm sure Flask has many of them as well.

bronze blaze
#

all right, I'll try the tutorial method

devout coral
#

Hello, anyone here use django-notifications package before? I am trying to find a good way to mark my notifications read but not sure what a good approach would be.

dense slate
#

@devout coral If you're comfortable doing it, I just made a simple ajax function that will refresh the events on the page with html/css that updates accordingly.

#

I'm not sure what the package does, but it was not a lot of work to get a notification system going.

#

And this way I had total control over it.

devout coral
#

So question, would it be smart to just set all notifications to read as soon as I click the notifications button?

dense slate
#

That depends what you want to achieve.

#

If you want them to read each item, make it per item. If you just want something like FB where it disappears after they open their notification window/drop-down, then sure.

devout coral
#

I want to make it per item but how would I set it to read as soon as they click it? Every notification is basically a url to go to what happened. I was thinking of just adding it to the body of the url but then I would need the id of the notification when creating the notification.

#

Not sure if I made sense.

dense slate
#

You can make the view of that event page set the event to read.

#

So when the event page loads, it changes its status.

devout coral
#

Correct. That is what I was going to do, but how would it know which notification it clicked. Since this "event" page could be the same url for multiple notifications

dense slate
#

You can send the event_id with the URL when they click it, load that object upon loading the view and if not read, mark it as read. Something like that?

marble carbon
devout coral
#

I was thinking of passing the notification ID in the url to use in the view but I cannot put the id in the URL while creating the notification.

dense slate
#

Why not?

devout coral
#

Oh wait.... I am dumb.

#

Just ignore me. Trying to do everything in one line when I do not have to.

dense slate
#

The struggle is real.

devout coral
#

Yeah

dense slate
#

Either way we got you where you needed to go!

devout coral
#

@dense slate Thanks, got it working

dense slate
#

Sweet deal.

topaz widget
#

Just a little freebie for anyone here -- I had a problem with a Django website where the name of the project has to be different on my local computer and server, so I wrote a script that goes through the entire directory and changes any reference to the project name both within file contents and in the names of the files and directories. I'm sure there are other programs that do this, too, and probably better, but I have tested this, and it seems to work, so I'm pasting the code for anyone interested in using it.

This works for any string/substring you want to replace anywhere within a directory with another string/substring. You can also include sub directories you want to exclude as long as it only requires the name (and not the full path) of the directory for specificity. You can see I excluded my virtual environment since it is a large, irrelevant directory, which would slow down the program. You can also choose which kinds of file extensions to check for since the string you're hunting for may only be in certain kinds of files.

#
import os, re, subprocess

# Target string and new string with which to replace it
target_string = 'local_site'
new_string = 'server_site'

# The root directory to make the changes to
target_dir = '/home/path/to/directory/containing/website'
# File types to check within for target string
file_types = {'js', 'css', 'html', 'py',}
# Subdirectories to exclude from search
exclude_dirs = {'venv',}

types_re = '('
for i, ftype in enumerate(file_types):
    if i < len(file_types) - 1:
        types_re += '\.' + ftype + '|'
    else:
        types_re += '\.' + ftype + ')$'

rel_dirs = []
rel_files = []
for root, dirs, files in os.walk(target_dir):
    dirs[:] = [d for d in dirs if d not in exclude_dirs]
    for d in dirs:
        if target_string in d:
            rel_dirs.append(os.path.join(root, d))
    for file in files:
        if re.search(types_re, file):
            rel_files.append(os.path.join(root, file))

# Go into each file and check for and change target string
for file in rel_files:
    with open(file) as read_file:
        new_file = read_file.readlines()
        
    with open(file, 'w') as write_file:
        for line in new_file:
            if target_string in line:
                line = line.replace(target_string, new_string)
            write_file.write(line)
    
# Change any relevant file names
for file in rel_files:
    new_file = '/'.join(file.split('/')[:-1]) + '/' + file.split('/')[-1].replace(target_string, new_string)
    file_cmd = subprocess.run('mv '+ file +' '+ new_file, shell=True, capture_output=True) #Command for Unix-based systems

# Put lowest directories first to avoid issues changing names
rel_dirs.sort(reverse=True)

# Change directory names
for rd in rel_dirs:
    new_dir = '/'.join(rd.split('/')[:-1]) + '/' + rd.split('/')[-1].replace(target_string, new_string)
    dir_cmd = subprocess.run('mv '+ rd +' '+ new_dir, shell=True, capture_output=True) #Command for Unix-based systems
#

Note: If you use this code, the commands (the first argument of subprocess.run) denoted by the comments will only work on Unix-based systems. You will need to use a different command if you are on Windows.

lean rapids
#

Is it possible to make the /admin site a login site for the admin user in flask? without making another template? and it only works for the admin?

#

if any experienced flask users could answer a could of questions in DM, i would really appricate it 😄

topaz widget
#

@lean rapids I don't know Flask, but I know Django, and it's definitely possible. What do you mean by make it a login site? Have a link on the home page? Redirect to the admin page if the user is an admin? Even though I don't know Flask, I'm sure both are possible.

lean rapids
#

@topaz widget So basicly, if i type in "something.com/admin" it sends me over to the admin page. (logged in)
but i dont want to be logged in, i want this site secured

#

do I need another template for this? which redirects me?

vestal hound
#

@topaz widget So basicly, if i type in "something.com/admin" it sends me over to the admin page. (logged in)
but i dont want to be logged in, i want this site secured
@lean rapids so you're saying you only want to be able to access it as an admin?

topaz widget
#

I didn't realize that was the default in flask. I'm sure you can change that.

lean rapids
#

yes @vestal hound

topaz widget
#

In Django, attempting to access the admin page will just give you a login screen unless you are logged in as an admin.

lean rapids
#

ohh, in flask i can only type /admin and im in , no need for login

#

but i kinda want to login, so noone else can just type in /admin and they can do whatever they want

topaz widget
#

Well, I'm sure there's a way to require user authentication to access certain pages or content. There's no way that's not a feature of Flask.

lean rapids
#

Maybe i have to make another template, but i was hoping i didnt have to :/

topaz widget
#

No, I doubt it has anything to do with templates. It mostly likely has to do with your views.

#

(python files)

#

I mean, you could probably handle it in the template, but I don't think that would be the best way to do it.

#

The best way would be to put that logic in the view and then return a different template depending on whether the user was logged in as an admin or not.

lean rapids
#

Read a lot about this func "is_accessible" which is suppose to do it, but i cant make it work, seem hundreds of tutorials but they kinda seem outdated, because they dont work 😦

topaz widget
#

Well, I don't know Flask so I can't tell you specifics, but I'm sure there is a way to do it that isn't too difficult. That's just too big a requirement for a lot of websites

lean rapids
#

ohhok,then im guessing i would have to make roles? (user or admin roles)

topaz widget
#

Maybe. Django has those natively, but you might have to create that yourself in Flask.

lean rapids
#

ohhok, well.. thankyou so much! 😄 I will probably have to go back to my googling/tutorial researching , there must be something , just cant seem to find it 😛

topaz widget
#

Yeah, the solution is definitely out there. Good luck!

lean rapids
#

Thanks 😄

topaz widget
#

If you're going to be doing complicated authentication stuff, you can always make the switch to Django, too. Django has a reputation for being better than Flask with more advanced stuff.

lean rapids
#

ohhh, my friend which is kinda experience(i think) in django, told me flask is easier (?) and sometimes better

topaz widget
#

From what I hear Flask is easier to get started with, but Django supports more advanced stuff better.

#

Steeper learning curve with Django but ultimately more powerful.

native tide
#

hey, stupid question, but is there some way to make google list the top navigation links like in this example:

#

something like manifest or sitemap?

topaz widget
#

Meta tags I'm pretty sure.

#

<meta ... />

native tide
#

they didnt even include a description or keywords

topaz widget
#

Let me take a look

native tide
#

there must be either some file i think or google does it itself and you cannot influence it

topaz widget
#

Well, then it probably has to do with how they index the pages.

native tide
#

thanks though

#

thats what i thought

topaz widget
#

@native tide Sure, yeah it seems like it's probably how their algorithm ranks the pages

plucky tapir
#

Small question but if I have a user logged in and I want to have the username at the top corner, do I have to push request username to the html?

versed python
#

@plucky tapir in django templates, the current user is accessible by {{ user }}. So in your case, you can do {{ user.username}}

jolly elm
#

Guys, why do I do a search and do the paging of this search occurs this error?
@jolly elm ???????????????????????????????????????????????????????????

versed python
#

what's the error?

jolly elm
versed python
#

code please

jolly elm
#

okey

versed python
#

not the entire code, just the part which is raising the error

plucky tapir
#

If I'm in a users app area, and I want to return to the base main page, what would I redirect to?

return redirect(request, '/')

#

Is what I thought but getting stuck

jolly elm
versed python
#

@jolly elm you need to explain your problem a bit more

plucky tapir
#

users/url.py

from . import views

urlpatterns = [
    path('', views.index, name='index'),
    path('register/', views.register, name='register'),
    path('login/', views.login_, name='login'),
    path('signup/', views.signup_, name='signup'),
    path('landing/', views.landingpage, name='landing'),
    path('logout/', views.logout_, name='logout'),
]```

main urls.py 
``` from django.contrib import admin
from django.urls import path, include
from . import views
from django.conf.urls.static import static

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', views.home, name='home'),
    path('users/', include('users.urls')),
    path('users/register/', include('users.urls')),
    path('users/login/', include('users.urls')),
    path('users/signup/', include('users.urls')),
    path('users/landing/', include('users.urls')),
    path('users/logout/', include('users.urls'))
]
versed python
#

@plucky tapir return redirect(reverse('index'))

jolly elm
#

@jolly elm you need to explain your problem a bit more
@versed python When I perform a search and paging the results of that search causes the above error

#

TypeError at /search/
object of type 'NoneType' has no len()

versed python
#

@jolly elm what are you subclassing your view from?

#

afaik, super().get_queryset() will not yield anything by default

#

can you add a print(result) after super().get_queryset?

stable kite
#

where @jolly elm is using len function in his code @versed python

versed python
#

I think one of Django's filter functions uses len. As you can see from the screenshot, the error is raised inside the django source code

stable kite
#

no i don't think so that Django's filter method uses len function

jolly elm
#

I think one of Django's filter functions uses len. As you can see from the screenshot, the error is raised inside the django source code
@versed python yes

versed python
#

it obviously does, since the error is being raised. Unless they posted the incorrect traceback/code @stable kite

stable kite
#

@jolly elm can you share the log of the server

jolly elm
#

@jolly elm can you share the log of the server
@stable kite I don't know where that is.

stable kite
#

it is in the terminal from where you type python manage.py runserver

jolly elm
#

okey

stable kite
#

why do split your query variable

jolly elm
#

why do split your query variable
@stable kite My teacher said it was like this

stable kite
#

you need to pass a argument to it

#

in this way you can split it

#

your spiliting is wrong

#

yes this is the log

#

share a screenshot of upper part of log

jolly elm
versed python
#

it depends on what query is. If it's whitespace separated, idts that's the issue

native tide
#

I am just getting into front end development and plan to just use sockets. I know how to feed raw html code into a response but is there any libraries to use the root directory of my TCP server for html and image files instead of hardcoding html?

#

If not I could probably just use os and read the files

cunning falcon
#

i am going to genius.com to get lyrics of a song, so when going to lyrics page, in their souce `html code, i see multiple elements so which element should i access to get the whole lyrics?

topaz widget
#

@native tide I don't think sockets are really relevant to front-end development.

cunning falcon
topaz widget
#

You're talking about back-end stuff by the way @native tide

#

with the exception of HTML, which is front-end.

#

@cunning falcon Access all the elements that contain lyrics.

cunning falcon
#

i was thinking about that only but its a command (so different song's lyrics) so different songs have different verses and all so elements are not the same in every song

#

its not possible..

topaz widget
#

It's definitely possible.

cunning falcon
#

how

dapper raft
#

I have question about django how we determine we need to make how many apps for any project

topaz widget
#

There is a pattern to the website and therefore it's possible.

dapper raft
#

On which basis we create apps

cunning falcon
#

im new to selenium

#

There is a pattern to the website and therefore it's possible.
@topaz widget can you tell me how?

topaz widget
#

What are you planning to use this for?

cunning falcon
#
async def lyrics(ctx, *, song):
    driver = selenium.webdriver.Chrome("C:\Program Files (x86)\chromedriver.exe")
    driver.get("https://genius.com/")
    search_song = driver.find_element_by_name("q")
    search_song.send_keys(song)
    search_song.send_keys(Keys.RETURN)
    
    prev_url = driver.current_url
    while True:
        if driver.current_url != prev_url:
            print(driver.current_url)
            break

    search_lyrics = driver.find_element_by_css_selector("a.mini_card").get_attribute("href")
    
    driver.close()
    driver.get(search_lyrics)```
#

a lyrics command

#

at last piece of code, i get to the page where lyrics is

topaz widget
#

@cunning falcon All the elements that contain lyrics have the class "referent" and it looks like "referent--yellow", too. I would start there.

native tide
#

I know I'm using my own backend so I don't have to server host like this book suggests me to do

cunning falcon
#

@cunning falcon All the elements that contain lyrics have the class "referent" and it looks like "referent--yellow", too. I would start there.
@topaz widget so what should i do?

topaz widget
#

find elements by class name

native tide
#

So if I could have my backend handle what the server host would it'd be good for learning

cunning falcon
#

should i do find_ele_by_class_name("referent")
then print(element.text)?

topaz widget
#

I don't know, I haven't used Selenium in a while. But using the class name is probably the way to go. If that doesn't work, those elements have all kinds of attributes you could use to find a pattern with.

cunning falcon
#

idk much about patterns too

#

im new to it

topaz widget
#

You don't know what a pattern is? What's your native language?

cunning falcon
#

hindi

topaz widget
#

But you learned English growing up, right? Don't most people in India learn English from a young age?

cunning falcon
#

yes

#

i did

topaz widget
#

Do you not know what a pattern is?

cunning falcon
#

im not talkin about that pattern

#

i know that pattern what you are talking about

#

but idk how do i implement that in my code

topaz widget
#

Code is all about finding patterns. If you don't know how to find patterns and write code to capture those patterns, I don't know how to help you.

#

I would just be doing your work for you. You have to find the patterns or see them, but I can steer you in the right direction.

#

@native tide I'm not sure what you're asking, and, to be honest, I think you need to do a lot of reading about basic web development concepts.

#

Confusing front-end and back-end tells me there are some pretty critical gaps in your knowledge.

native tide
#

wait isn't html front end?

topaz widget
#

yes but everything else you said wasn't.

native tide
#

Maybe the failing in my part isn't knowing enough of what I want to do

topaz widget
#

So are you trying to set up an http server then?

#

If all you're trying to do is build some web pages and link them together, you can do that with http.server

#

Is that what you're trying to do?

#

If you're actually trying to build a website, you need to do a lot more than that.

native tide
#

I don't want to host it on the www I just want to use localhost to see webpages I make

#

And it'd probably make my life a lot easier in the future if I read the front end code off of files rather than hardcoding it into my server file

#

I'll check out http.server

plush fjord
#

http.server is really helpful and it can serve your HTML code off your current (or specified) directory.

#

Basically it spins up a webserver on your local machine and the static pages (including JS & CSS) are hosted off the server. You won't be needing any sockets/os module for doing the same.

viscid roost
#

Anyone tried DRF with Flutter

native tide
#

Thank you I appreciate it this looks like what I needed

topaz widget
#

Again, I waded into DRF briefly.

viscid roost
#

Django rest framework is awesone

native tide
#

Don't want to try and make something that already has a library

topaz widget
#

@native tide If all you want is a local http server for the time being, just use the following command in the directory containing your root webpage (often index.html):
python3 -m http.server 8000

#

Do you know how to use the command line?

native tide
#

Oh on god? That's pretty sweet

#

Much easier than using a socket

#

Yeah I know command line

viscid roost
#

Yeah python has lot of potential

topaz widget
#

Okay, also... you can use any number that is an available port after http.server, 8000 is just a typical one to use for localhost @native tide

viscid roost
#

you can specify the port

#

if you want

native tide
#

I usually used 8080 I know it isn't that important which

topaz widget
#

That would work fine.

viscid roost
#

port are just for yourself

topaz widget
#

But if you have multiple directories open at the same time you want to run at the same time, you can use different port numbers.

viscid roost
#

I used something like 10 to 15 ports per day

native tide
#

I used sockets on using a esp32 as a server so I was going off that

topaz widget
#

Yeah, http.server takes care of all of that. It just turns your file directories into http protocol.

viscid roost
#

Yeah @topaz widget

#

I like Python very much.... But don't from where Javascript evil has came

topaz widget
#

JavaScript was supposedly written in 10 days.

#

So maybe that explains some of it.

viscid roost
#

Bro Javascript is trash use typescript instead

#

I used javascript for react js..... Angular is more good

#

It uses typescript

#

Now I also don't have to use React Native

#

because Another King is there

topaz widget
#

Another King?

viscid roost
#

Yeah

#

With Lot's of powerfull toolkit

#

and more speed

tepid lark
#

The Js stdlib has greatly improved

viscid roost
#

JS is trash....

#

I know three to five languages for which I can make everything that I want

tepid lark
#

yeah typescript is just a big footgun protector

native tide
#

I don't know any js yet

viscid roost
#

Yeah If typescript was not there I will never loot at javascript world

tepid lark
#

Read Eloquent JS, it's a good book and there's a free online version.

viscid roost
#

I was very much impressed by typescript

native tide
#

Free online books sign me up

viscid roost
#

@tepid lark I know JS very well.... After that I did breakup with it

#

You can make everything in just one language

topaz widget
#

@native tide If you want to do front-end web development, you should probably learn JS

viscid roost
#

Never.....

#

typescript => angular

#

no js

topaz widget
#

Don't listen to him.

tepid lark
#

I mean use TS

viscid roost
#

Yeah'

native tide
#

I got a book on php, html/css, and js

viscid roost
#

TS >>>>>>>>>>>> JS

#

php is that a joke

#

You can python and django which has async also

vestal hound
#

@native tide If you want to do front-end web development, you should probably learn JS
@topaz widget you can use TS for everything you can use JS for

tepid lark
#

nothing easier than enabling mod php on apache and throwing up some php

native tide
#

Php's name acronym makes me happy

vestal hound
#

Php's name acronym makes me happy
@native tide it does though, doesn't it

viscid roost
#

PHP is old tech

tepid lark
#

PHP 7 and 8 are/will be quite nice to work with

topaz widget
#

But why not just learn JS to start out with?

vestal hound
#

hm

topaz widget
#

And then just extend your knowledge with TS

viscid roost
#

Learn TS bro

vestal hound
#

I think it's the other way round

topaz widget
#

From what I understand, TS is a superset of JS

viscid roost
#

No TS is a superset of JS

vestal hound
#

it is

topaz widget
#

so learning JS won't hurt you in learning TS.

viscid roost
#

superset means you don't have to learn JS

native tide
#

I like to start with building things and then delving deeper into those things

viscid roost
#

You can directly jump into TS

vestal hound
#

so learning JS won't hurt you in learning TS.
@topaz widget but there are things you should do from the beginning if you're planning to use TS

#

in particular, typing.

tepid lark
#

there's some tooling but tsc isnt hard

vestal hound
#

like you can write Python without type hints

topaz widget
#

@vestal hound Such as?

vestal hound
#

type hinting, more or less

tepid lark
#

hence the type

vestal hound
#

and because you are going to type your functions and stuff

viscid roost
#

Yeah... If you trying to debug js... It's very hard

vestal hound
#

it would be better if you wrote your interfaces and types from the start

#

since they need to be defined separately

viscid roost
#

When I was intern at microsoft We used TS heavily

#

and python

vestal hound
#

good for you

native tide
#

There's many ways to skin a cat I feel

topaz widget
#

Okay, do what they say and learn TypeScript then @native tide

tepid lark
#

TS bindings are great when you have some thirdy party lib

vestal hound
#

I mean

viscid roost
#

Yeah... You can easily debug TS

topaz widget
#

They seem to know more about TS than me, so I will defer to their judgment.

vestal hound
#

you don't have to unless you're going to use Angular, at which point I think it really makes sense

viscid roost
#

But dart also amazed me

vestal hound
#

and I am a firm believer in the value of typing

viscid roost
#

in FLutter

vestal hound
#

in particular, when you use languages with very powerful type systems

#

you see their value in detecting errors at compile-time

viscid roost
#

@vestal hound did you mean Java

vestal hound
#

however, if you're still experimenting and you just wanna play around a little...

#

@vestal hound did you mean Java
@viscid roost no.

#

Java's type system is not powerful.

native tide
#

I don't know how far I plan on going with web development but it'd be a good way of furthering my knowledge in computer science in general

#

Hi all

vestal hound
#

hello there

tepid lark
#

Hi

native tide
#

If it might help me in the long run and net me a career someday I add it to the list

topaz widget
#

Well, you should either learn TypeScript or JavaScript if you plan on doing front-end development unless you want a potato website.

vestal hound
#

They seem to know more about TS than me, so I will defer to their judgment.
@topaz widget do you type hint your Python code?

native tide
#

Whats the best way to go from nodejs to Flask?

tepid lark
#

no JS, only HTML

native tide
#

and which one is better just curious

topaz widget
#

@vestal hound No. should I?

viscid roost
#

If you want to be web dev
BACKEND => DRF, DATABASES
FRONTEND => VUE, ANGULAR

vestal hound
#

ah, that's probably why

native tide
#

I need to get good at databases

vestal hound
#

@vestal hound No. should I?
@topaz widget do you use any statically typed languages?

topaz widget
#

I try to keep all my variable names as unique as possible.

#

Not really, no @vestal hound

viscid roost
#

Postgres is great

native tide
#

Mongodb is great

vestal hound
#

you can detect a lot of errors at compile time

native tide
#

Postgres seems nice

vestal hound
#

if you use a language with a sufficiently powerful type system

viscid roost
#

MongoDB is also great

vestal hound
#

because the compiler can prove that those errors can occur, given certain input

#

and alert you accordingly.

native tide
#

If I can get it to work on my shitty chromebook massive brownie points

vestal hound
#

type hinting is a way of bringing some of those benefits to dynamically typed languages

native tide
#

Because mysql was not having it

vestal hound
#

like Python and JS

viscid roost
#

look user don't care in which tools you made the product they only cares in look and performance

native tide
#

whats the best way to learn Flask coming from a nodejs background

vestal hound
#

you can use JS instead of TS, just like you can use Python without type hints

tepid lark
#

No love for SQL Server huh

vestal hound
#

and in cases of small throwaway scripts it probably won't matter

#

but as your codebase increases in size, maintainability is markedly increased by proper typing

topaz widget
#

@vestal hound Maybe I don't know what I'm missing, but I feel like I've been able to debug fine with dynamic typing.

viscid roost
#

Flask... is a pain in neck

#

it don't have anything

native tide
#

really?

viscid roost
#

FastAPI is great

tepid lark
#

Flask is great for small projects

native tide
#

oof

#

so I shd stick with nodejs?

viscid roost
#

I don't like node

tepid lark
#

What sort of app are you making?

viscid roost
#

I like Django rest framework

native tide
#

just like a small non profit project

viscid roost
#

its asynchronous ability gives it power with security

vestal hound
#

you can use Node if you want

#

it's not a bad choice by any means

native tide
#

so node good flask bad?

vestal hound
#

Flask is...

#

not bad

viscid roost
#

Node has security issues

#

Django has built in secutiry

native tide
#

damn

vestal hound
#

but you need many other parts

tepid lark
#

well node isn't a web framework

vestal hound
#

to build a fully-featured backend API

topaz widget
#

Don't get too comfortable with Django, though.

vestal hound
#

^

plush fjord
#

I wouldn't say Flask is bad but when you're dealing with big projects, you tend to outgrow the framework

native tide
#

I worked with Flask I agree it is a pain in the neck

vestal hound
#

comparing Node to Django is pretty weird

tepid lark
#

I've found Flask is really easy for my use cases

topaz widget
#

Its security at least. Django's default authentication system leaves a bit to be desired.

native tide
#

ahhh I see

viscid roost
#

You can use any database in Django.... without writing in SQL

native tide
#

For small projects flask is probably neat

vestal hound
#

Node has security issues
@viscid roost like what

tepid lark
#

I use SAML so support is universally spotty

vestal hound
#

You can use any database in Django.... without writing in SQL
@viscid roost Django's is not the only ORM available

tepid lark
#

well use it for authn

native tide
#

But for complex tasks I see flask just not doing it

viscid roost
#

Node don't have built in auth

topaz widget
#

@viscid roost Yeah, Django's ORM has been pretty decent in my experience.

tepid lark
#

Python doesn't either lol

viscid roost
#

it don't have hashing

native tide
#

okay so I should start with flask and if it gets big, I should move to smth else like Django?

viscid roost
#

Django

#

will be great

vestal hound
#

Django
@viscid roost Django is not Node

native tide
#

Just use Django

tepid lark
#

Django is great for crud apps

topaz widget
#

@viscid roost Yeah, node or express's lack of built-in auth led me to abandon it back to Django.

vestal hound
#

why are you comparing a runtime environment to a backend framework

tepid lark
#

You'll be fighting with django if you're doing things outside the box

vestal hound
#

you might as well say Play > Python

plush fjord
#

Node used to have security issues in terms of packages and on who published the packages but I think it's now fixed as NPM is also having checks from their end

viscid roost
#

Because we are taking about backend

native tide
#

okay

#

so ig i'll learn django then

vestal hound
#

okay, I primarily use it with DRF

viscid roost
#

Yeah correct

vestal hound
#

but fair, it is a web framework out of the box

tepid lark
#

Node would express or sails

topaz widget
#

@native tide Probably not a bad thing to learn if you already know Python.

native tide
#

okay cool

#

I know a bit of python and node

topaz widget
#

What do you use with DRF?

viscid roost
#

Well you will never make a website with Django..... Use DRF + some frontend framework

vestal hound
#

What do you use with DRF?
@topaz widget what do you mean?

#

oh, btw

topaz widget
#

I assume some front-end framework but I missed the thread.

vestal hound
#

Django lacks type hints

#

which is annoying

#

I personally use Angular

tepid lark
#

If you're doing some small nonprofit site the best one is the one that lets you get shit done

viscid roost
#

Yeah me too

vestal hound
#

but it's up to you

topaz widget
#

Have you ever used Vue @vestal hound

vestal hound
#

nope

topaz widget
#

Would you like to?

viscid roost
#

My tech stack is .... Flutter + DRF + Java + angular

tepid lark
#

Vue is neat, nicer to learn than react

vestal hound
#

I wouldn't mind trying it out for a hobby project

viscid roost
#

React is fucl

vestal hound
#

what do you even use Java for

#

there are exactly 2 good things about Java

topaz widget
#

For caffeine

viscid roost
#

Java for Native Android Dev

vestal hound
#

the strength of the ecosystem, and the power of the JVM

viscid roost
#

Oops sorry.... I switched to Kotlin

#

instead of Java

native tide
#

AAAA

vestal hound
#

a wise choice

topaz widget
#

@tepid lark Yeah, I liked Vue better when I was shopping around for a front-end framework to dig my teeth into.

native tide
#

kotlin syntax makes my head hurt

viscid roost
#

Kotlin is new official language for Android

#

Google is moving Java out of the frame now

plush fjord
#

sometimes, Java sucks for the JVM part as when you're having complex requirements (say media streaming) and when you're trying to get the most out of your server then the same thing bites you back and you generally find yourself meddling with the JVM settings

#

This is something which I faced.

vestal hound
#

yeah

#

that is true

viscid roost
#

I use DRF for server side

#

dev