#web-development

2 messages · Page 175 of 1

patent cobalt
#

I'm not sure what could cause that error, but there's not a lot to go on

#

It could be that something in the installation of uWSGI went wrong, or that it's a configuration error

native tide
#

I guess so, i will try to setup Gunicorn if it works

#

thanks a lot!

thorn pollen
#

TLDR; Flask or NodeJS for a web app (100k users) 0.5-2k active at a time.

I am hosting a web app for around 100k+ users.
Currently i have made a flask app served via gunicorn to be hosted on Heroku or another VPS.
It is not a big web app, its a simple service to allow users to connect their LINE account with my service and every 1hourly i send web requests to LINE API endpoints from the collected users information.

Q. Should I switch from Flask to NodeJS ?
I haven't deployed the service yet, but yes, tests works fine for now.

Q. Would NodeJS provide me with better performance in terms of sending web requests to an API endpoint (around 15-20k requests) every hour My service is a notification service which sends hourly notifications via LINE app

#

I need to be able to save user tokens when they login with my service, to some sort of database. Im using Sqlite for development and MySQL for production right now

*Database entries yet to be grabbed. So no database migration required. I can work on different database is need be.

inland oak
#

and it would not matter which framework you used

#

it only depends on where you remember/easier to find the syntax to implement caching between app and db

#

and at the same can be applied caching at level of reverse proxy, which is sometimes called web accelerator I think

#

basically, I think there is no difference between Flask and NodeJS in terms of performance, it totally depends on your skills to use it

native tide
#

i want to create a page (only admin access) where displays users list with all the data, how can i do it ?

thorn pollen
topaz flower
#

Hi. I have an application that I developed with the flask framework. I intend to send a number of real-time notifications from the server to the client. I want to know if I use a web socket or a socketio! The problem with socketio is that it cannot launch multiple workers.

glossy scroll
#

hey guys

#

How do i flip boolean value in django admin list action?

#

i tried this but it doesnt work:

#
@admin.action(description='Toggle featured product')
def toggle_featured(modeladmin, request, queryset):
    t = queryset.filter(featured=True)
    f = queryset.filter(featured=False)
    t.update(featured=False)
    f.update(featured=True)
dusk portal
#

make folder name "templates" note case sensitive dont make mistakes

#

any django (kind of exp dev)?

#

i need some strong suggestion's

eternal blade
#

Just ask your question

dusk portal
# eternal blade Just ask your question

so sir i dont have any particular question but im kind stuck so i'm constantly working on django from last 2 months , i have made many apps like a simple bs4 proj then todo app then blog then user auth apps and was making a e-commerce app by own from last some days , learned many things but sometimes i get stuck how can i take my django skills to next lvl and i have saw Corey Schafer's Playlist , Clever Programmer 8 hrs vid and begginers those 10 parts docs .. Then while making project also learned many things like Search Functionality backend , now how can i get to more advanced + i have 1 kind of problem

eternal blade
dusk portal
#

ohh but i have to master this django

eternal blade
#

And make a api

dusk portal
#

ohh

#

ik what is api

#

but idk ppl say api

#

;-;

#

plz explain

#

i know api but then too idk

#

haha

#

half knowledge

eternal blade
#

application programming interface (api) is a connection between computers or between computer programs. It is a type of software interface, offering a service to other pieces of software.

dusk portal
#

and i have like 3-4 problems which i can only explain in voice chat or show in screen share

#

i have no teacher

#

self learner from india age 16

#

;-;

eternal blade
#

You see buttons like sign up with google in websites right?

dusk portal
#

yes

eternal blade
#

It uses googles api and signs you up automatically according to your google account info

dusk portal
#

oh that integration

#

ohh

eternal blade
#

Yes

dusk portal
#

first can u clear my 2 to 3 problems

#

where can i share screen

eternal blade
dusk portal
#

ohk but can i share screen there

#

now i cant share screen

fossil sphinx
#

is anyone experienced in flask?
i have an assignment and don't know how to solve it.

calm plume
dusk portal
calm plume
#

I have no idea what your question is

dusk portal
#

And Ofc Django query

calm plume
#

Have you messed with DRF?

dusk portal
#

Nah never gone through
Django Rest Framework
And planned to do it after mastering django

dusk portal
#

And payment Stripe Gateaway also idk

#

Like Youtubers put thier yt vid on thier site
By yt api that too idk
And Google Maps api

#

Idk that too

#

Umm

#

Are those all done by drf or also can be done by Django

calm plume
calm plume
dusk portal
dusk portal
calm plume
#

That's not django specific

dusk portal
#

Ohh

#

Means i have Learned django

#

But but then too some too (i say insane lvl ) problem's which i can only explain while screen share

#

Like my Order History fun have. A prob

#

@calm plume

elder nebula
#

In django is it bad practice to declare divs and other html elements on views?

#

it sure looks bad

dense slate
elder nebula
#

And if it's today I put text into the div which says today

#

and also color it blue

dense slate
#

I think you should be handling that in your templates.

#

Based on what data your function returns.

elder nebula
#

hmm... It's a bit difficult, because I am wrapping the day name into <strong> tag. Maybe I just render them at different times, but then the alignment might not be always correct.

dense slate
#

So aren't you just returning the date? Could you just return a value/object/context that also sets the day of the week, and then in your template display {{object.day}} or whatever?

elder nebula
#

I'll experiment with different ways of doing in. Right now I return a list to the template and mark it as safe and that works fine for now.

zealous lagoon
#

how to i not let something get deleted.
i'm doing a contenteditable="true" thingy on a <pre> tag and there's something inside it that'll be gone the moment i press Ctrl + A and backspace how do i prevent user from doing that?

#

the html code:

<pre id="code" contenteditable="true" oninput="update()"><code id="code2" class="language-python"></code></pre>
#

so uh the code2 object will die as soon as i do ctrl+a backspace

#

how do i prevent that

#

*ping to notify 😄

rustic sky
#

Django admin, project hosted on PythonAnywhere. Why does the add page look like this?

#

especially the top part, everything else is fine I think

#

???

dense slate
#

Are you using some kind of 3rd party admin template?

rustic sky
#

No

dense slate
#

And if you refresh few times it stays that way?

#

Is it every page or just one?

rustic sky
#

yeah, refreshing does nothing....

dense slate
#

Is it different locally?

rustic sky
#

rest of the pages.... let me test

rustic sky
#

this is the main page

dense slate
#

Ok so it's fine on your machine, but not when you deploy it.

rustic sky
#

yeah

dense slate
#

I know Django 3 changed the admin templates a bit in terms of layout.

rustic sky
#

....this is a different model.... same result

dense slate
#

Well if it works fine locally, and you're sure it's the same code, then that rules out the code being an issue. Maye the CSS isn't loading properly.

#

Or some dependency isn't installed?

#

I'm just tryin to think what else could be different on a different machine.

rustic sky
#

hmm

#

I'm going to have to do a pip freeze

#

also, this is what it looks like locally... the dark mode... not sure where it is coming from

#

welp, the list on PythonAnywhere is really long, lol

#

though I ran the same commands while doing it on the site... no extra things where added

#

nope, wrong version of django apparently :/

#

could've swarn I got the right one (3.2)

wraith pond
#

how to update a flask page when its like refreshed like imagine i have variable

a = 'a'

@app.route('/'):
...
  return render_template('../home/home.html', var=a)

now for example i changed the variable to a='b' i want it to update when i refresh now, as of now when i refresh the page it still shows a

eternal blade
#

You can use some js to reload the page

wraith pond
eternal blade
#

location.reload();

#

Haven't tried it should work

#

And how will the values be changing while a user is viewing the page?

wraith pond
#

so like i would create a .js file then name it something then type this then?

wraith pond
eternal blade
#

so you want the content to change when they refresh the page?

wraith pond
#

yes

eternal blade
#

how will you be getting the value a?

#

will it be a constant or will it be a value returned by another function?...

wraith pond
eternal blade
#

you can use some js

wraith pond
eternal blade
wraith pond
eternal blade
#

The text file contents wont change

wraith pond
eternal blade
#

Oh

wraith pond
#

is their way like when we refresh the page in a browser, it sends this in terminal 127.0.0.1 - - [26/Jul/2021 21:54:45] "GET / HTTP/1.1" 200 -
so is there a way to like reload the value of a from the text file when this is sent in terminal or when the webpage is updated?

eternal blade
#

then you can open the text file and read it and set the value to a, a will be what ever the text files content will be

wraith pond
eternal blade
#

yes, it should

#

but if you are changing the value of a manually while the server is running it won't update in the front end

wraith pond
eternal blade
#

Show your code

shrewd sand
#

didn't realize there was an ongoing discussion will come back later

eternal blade
#

its ok, send your question here

wraith pond
#
app = Flask(__name__, template_folder="webpage")
app = 
with open('value.txt') as f:
    a = f.read()

@app.route('/')
def test():
    return render_template("index.html", var=a)


if __name__ == '__main__':
    app.run(host="localhost", port=3001)
elfin remnant
#

How to learn django if I'm stupid

eternal blade
wraith pond
eternal blade
#

yeah, that's also possible

#

Try and see now

native tide
#

i want to create a page (only admin access) where displays users list with all the data, how can i do it ?

wraith pond
#

ty

eternal blade
#

👍

elder nebula
#

and then add the loginMixIns

#

and make it return what you want

elfin remnant
#

how to learn django if im very stupid

elder nebula
#

Official tutorial is good for everyone

#

or just go for the docs and start building / testing things out

elfin remnant
#

i just noticed i put the polls folder in a wrong directory

dense slate
#

what's the error

#

You press submit and it sits there?

#

What's the form code in your html?

dusk portal
#

how can we create reset password functionality without ```py
from django.contrib.auth import views

dense slate
#

why is there a space after eventform everywhere?

#

ok

#

I can't quite remember exactly, but either you can use action="" in the form to signifiy which function to use

#

but you shouldn't have to I think

#

but sometimes that helps to be specific

#

look up using a form in django templates and usign action="" in the form

#

the "" being the function to use

#

err, whatever, flask.

#

But you should at least be getting an error if that's the case.

#

If nothing happens, then the form isn't submitting through the backend.

#

Does flask have a debug mode? Like if a function has an error, does it display it on your page?

#

Yea so then there's probably no obvious functional error. It just isn't doing anything

#

First box shows them using action.

#

You did what in terminal?

#

Maybe take the date out and see if it works.

#

So you at least know your form works or not.

#

Uh no, just remove it from your form and make your function not require it (and of course make it not required in the DB if you must)

#

I would still expect the webpage to give you an error page/500 or something if the backend was the problem.

#

Before you do all that, just add the action to the form

#

like it shows at that link

#

the route in the quotes for action="" should be from your urls/routes file

#

that then points at the function that handles the form on the backend

#

ok and it's pointing at one of your urls?

#

and that url points to which function?

#

can you paste your urls file and the function it goes to?

#

So I don't know how flask works exactly, but this doesn't look right.

#
  project_id=1
  eventform = CreateEvent()
#

isn't that supposed to be a function?

#

isn't the @ just a decorator on a function?

#

👀

#

Without the date?

#

Sweet deal.

#

So at least now you know that and can figure out why that error is happening.

#

first result on google

grim cedar
#

hi guys can u recommend any simple framework for creating blog ??

#

🧐

grim cedar
#

umm does it have all those syntax highlight ??

dense slate
#

so you have to find a way to match the date syntax, if they are different

#

what's the datefield on the form passing to the backend, a string?

#

usually you need to convert that to a datetime object on the backend.

#

print it from your function

#

print the value being passed into the function

#

Depends how you pass it. Maybe a value name, maybe kwargs/args, I don't know. You left that out above.

#

you might be able to print the post request

dusk portal
#
from django.urls import path
from . import views
from django.contrib.auth import views as v_views

app_name='users'

urlpatterns = [
    path('register/',views.register,name='register'),
    path('login/',v_views.LoginView.as_view(template_name='users/login.html'),name='login'),
    path('order_history/',views.order_history,name='order_history'),
    path('logout/',v_views.LogoutView.as_view(template_name='users/logout.html'),name='logout'),
    path('password_reset',v_views.PasswordResetView.as_view(),name='password_reset'),
    path('password_reset_done',v_views.PasswordResetDoneView.as_view(),name='password_reset_done'),
    path('password_reset/<uidb64>/<token>/',v_views.PasswordResetConfirmView.as_view(),name='password_reset_confirm'),
    path('password_reset_complete',v_views.PasswordResetCompleteView.as_view(),name='password_reset_complete')

]```
dense slate
#

Where is the password_reset function? @dusk portal

dusk portal
dense slate
#

I don't see password_reset_confirm in your urls

#

I see complete though.

dusk portal
#

what u mean

dense slate
#

where is the url pattern?

#

password_reset_confirm

#

ohhh, sorry I see it

dusk portal
#

lol

native tide
#

<tr>
  <!-- this is a random profile image not customizable, for now -->
  <td class="py-1">
    <img src="../../assets/images/faces-clipart/pic-1.png" alt="image" />
  </td>
  <td> HERE THE NAME AND LASTNAME </td>
  <td> HERE EMAIL </td>
  <td> HERE USERNAME</td>
  <td> HERE DATE OF REGISTRATION </td>
</tr>
<tr>

#

how can i create a loop that gives that informations for each user

#

like to create a table

#

@elder nebula

fervent terrace
#

Got a FastAPI webapp which I'm presently running with uvicorn.

I'm configuring logging to use structlog as I liked it's easy approach to getting JSON log output.

Now, I am battling uvicorn which seems to start some loggers - but its website doesn't cover how to override logging to any great detail. It only seems to concern itself with taking a dict based logging config, instead of e.g. some factory hook method one could override.

Anyone been in this situation ? I want uvicorn's log output, I do NOT want it formatted the way it is, I want to use a structlog logger.

elder nebula
native tide
dense slate
#

You can use a for loop in the template. @native tide

native tide
dusk portal
#

;-;

#

anyone's up

dusk portal
naive rock
#

If we want to send an email through python, do we need to enter our password, or can we do it with authentication/authorization key?

dusk portal
#

hey

#

anyone's up

#

!!!

elder nebula
# native tide yes i know but i dont know how to do it (im a beginner programmer)

Alright so first return it in the context
like so in your views.py

from django.contrib.auth import get_user_model



def my_view(request):
    User = get_user_model()
  
    context = {
        'users': User.objects.all(),
    }
    return render(request, 'index.html', context)```

Now inside `index.html`
```html
{% for user in users %}
{{ user }}
{% endfor %}```

in your urls.py
```py
from .views import my_view

urlpatterns = [
  path('users/' my_view, name="users")
]```
#

And you should be ready to go

opaque rivet
#

I've got two microservices that need to have the same django model. Is there any way to automatically update both models if I change one?

tiny crest
#

i should learn django 2 or django 3?

opaque rivet
native tide
#

like how can i add a number for each user

edgy anvil
#

i was looking to integrate my dash app into my flask and i saw a solution in where you can just link it and it appears like two websites how would i do that?

#

this si what it said

inland oak
#

tbh, it sounds like you just should split your database properly between them

#

otherwise... i don't know, in any of them writing extra careful SQL request that is not tied to changable model as maximum as it is posible?

#

if necessary writing in raw SQL language
there are some other choices, but there are much worse

#

my most recommended choice: Split database proplerly, so it would be independent between them

as half silly easiest choice, make second application, requesting data from first one to make copy of db
or tie data with some specified key between those two dbs

alpine ingot
#

Anyone tried starlette, responder & fastapi instead of flask for full stack, and did you come across any issues

surreal portal
#

Hi, does anyone has a good way to automaticallyc reate a profile in Django without going through the hassle of using python manage.py createsuperuser ?

dusk portal
#

It's so much simple bro

#

Even a 8 years kid can easily do

surreal portal
dusk portal
#

U do not have to run this command every time

#

Only 1 time

#

For creating Owner of That Admin page

#

Who will be like
Who will have ownership there

#

;_;

#

If u don't use that impossible cez if u make users directly how will they get permission to login toh admin panel

#

😂😂

#

No logic bro

surreal portal
#

ok then, what about a list of users for testing

dusk portal
#

Why u wanted to work extra

#

;_;

#

Same output

surreal portal
#

For the sake of testing

#

Also I run Docker containers

dusk portal
#

Ohh

surreal portal
#

And I have a habit to purge data when I no longer need it

dusk portal
surreal portal
#

ofc in prod I will only need the CLI

north iris
#

Hey guys! I am going start to learn Django very soon. Can anyone recommend me the best, easy to understand course/video lectures online available.

#

Thanks in advance

gusty wagon
#

I have an XML file which in some elements I deepcopy the element and make 2 types of it. But they also have a unique field id. I try to seperate same elements by adding 'R' to the id. Well thats what im hoping for, but I cant override the value. Can someone see whats going on in here?

Deepcopy elements:

estate_for_rent = copy.deepcopy(raw_item_data)
estate_for_sale = copy.deepcopy(raw_item_data)

Changing value and printing it out:

print("sale id: ", estate_for_sale.xpath('./@id')[0])
print("rent id: ", estate_for_rent.xpath('./@id')[0])

estate_for_sale.xpath('./@id')[0] = estate_for_sale.xpath('./@id')[0] + 'R'

print("sale id after: ", estate_for_sale.xpath('./@id')[0])
print("rent id after: ", estate_for_rent.xpath('./@id')[0])

Output:

sale id:  12614
rente id:  12614
sale id after:  12614
rent id after:  12614

Output should be for example: estate_for_rent id = 12614 and estate_for_sale id = 12614. What am I doing wrong?

native tide
#

can someone help with dashboard for discord

next comet
# north iris Thanks in advance

if you have linkedin learning there are a good django courses, if you stick to the free stuff check Tech with Tim or Corey Schafer videos on youtube, there is one 1hour introduction by Code with Mosh so you can check this for a fast overview of django

native tide
#

how can I put the "name" in the registration as optional

whole spear
#

damn, I'm gonna learn JS by the rate I use Selenium for my project

native tide
elder nebula
#

the numbering system?

native tide
elder nebula
#

great

mild bridge
#

Is anyone here familiar with typed Django? I'm running into a problem with hinting authenticated requests that I'm sure other people have run into before.
The django-stubs docs suggest that authenticated requests can be hinted with an AuthenticatedHttpRequest class that looks something like this:

from django.http import HttpRequest
from foo.models import FooUser

class AuthenticatedHttpRequest(HttpRequest):
    user: FooUser

The issue is that foo.FooUser isn't always the user model throughout the project - this monolith can be deployed under different conditions, some where we can be sure that request.user will always be bar.BarUser. I'm wondering if there's some idiomatic method to hint request.user that maybe pulls from django-stubs' internal magick for pulling user classes?

#

Apparently doing something like user: get_user_model() is an illegal type annotation since call expressions aren't allowed, but I can't think of a nicer way to handle this

carmine cipher
#

Hello guys,I want to make a web site where user can enter information like : email,lastname,firstname, age ... In order to have them in a database.Can someone give some tips what language , framework are better to do that.I wanna need help.

native tide
#

hi guys i have a question. If i wanted to design a website manually, is there any website that would allow me to do that but also be able to provide the html,css and javascript code for the design that i would have made?

gritty cloud
#

at least i think

eternal blade
elder nebula
carmine cipher
carmine cipher
eternal blade
signal bronze
elder nebula
eternal blade
#

Yes

elder nebula
#

It's pretty quick.

signal bronze
#

i still say go for flask

#

you learn more that way

#

and much easier

elder nebula
#

They are both easy, but flask is good for prototyping / doing lightweight stuff so django might be a overkill if you want to just store user data.

carmine cipher
signal bronze
#

jod?

elder nebula
carmine cipher
signal bronze
#

When i was starting out in web development, i used flask and it was simple and easy for me to get started on a web application

elder nebula
#

Django is good choice, most companies use it.

signal bronze
#

companies also use flask

elder nebula
#

Yes they do

signal bronze
#

flask is so light and simple whilst teaches you alot about how everything works

carmine cipher
signal bronze
#

use flask

#

you could do it under 100 lines of codes

elder nebula
native tide
native tide
carmine cipher
# signal bronze use flask

Thanks guys for your tips . I'm going make more research about flask and django and choose what is better for me.

elder nebula
native tide
#

ah i see.thanks.

scenic dove
#

Hello

#

I have been learning django for a while now but from time to time i feel like i should've started with Flask or something else that lets u build more things from scratch

calm plume
#

Django is a lot nicer imo, since it handles database stuff for you

#

It's batteries-included style is what I prefer more than Flask

scenic dove
#

So if u have been doing web for sometime and encountered with some web frameworks do advise me to stop and start all over againg or just continue

calm plume
#

For most projects, I'd use Django or FastAPI, both are really great

scenic dove
#

It's batteries-included style is what I prefer more than Flask
@calm plume yea
But there are somethings that i feel wired about
Like i understand it but not really or i feel that i got it but there's something in it that didn't click and i don't know what is it

calm plume
#

Django is pretty confusing, yeah. The only way to really understand it is build projects in it.

scenic dove
#

Yea im doing it
I made a poll app and a small blog app

#

I looked alot into djangos files to understand how it works but it is too complicated and eats hell alot of time, Pushes to think i should have started with flask

elder nebula
#

Django was confusing for me until I fully understood how it's supposed to be used

#

Like what is supposed to go into views.py ect

scenic dove
#

Was it ur first framework?

elder nebula
#

You can do both in both if you want. It's just flask has less ready and django has more ready made. Sometimes django has too much ready.

scenic dove
#

I think ill start flask

eternal blade
elder nebula
scenic dove
#

K

#

Thanks

dense slate
#

Anyone use Django's auth in addition to JWTs? Like for password reset?

gritty cloud
#

along with hundreds of other open source packages adding graphql, rest, jwt auth, forms, css, other db engines

long jackal
#

why is this button not being centered

.quickplay {
    position: absolute;
    text-decoration: none;
    color: white;
    text-align: center;
    margin: 0;
    font-size: 45px;
    background-color: purple;
    border-radius: 10px;
    padding: 0px 10px;
    transition: 0.4s;
}
    <span class="page-content">
        <a class= "quickplay" href="/templates/quickgame.html">Test</a>
    </span>
dense slate
#

It might be centered in the span, but is the span centered?

long jackal
#

oh that might be the issue

#

well I did this

.center {
    text-align: center;
}
    <span class="page-content center">
        <a class= "quickplay" href="/templates/quickgame.html">Test</a>
    </span>
#

didn't center it

dense slate
#

what's the page-content css

#

And what is the span inside of?

#

Because that div probably needs centering as well

long jackal
#

page content is just zindex + 2

#

and span is inside body

dense slate
#

Put span inside a div

#

make the div width=100%

long jackal
#

100% what

#

alr

dense slate
#

but that div might also need centering

long jackal
#

this is what I did

    <div style="width: 100%;">
        <span class="page-content center">
            <a class= "quickplay" href="/templates/quickgame.html">Test</a>
        </span>
    </div>
.center {
    text-align: center;
}
#

still not centered

dense slate
#

you didn't center the div

long jackal
#

oh

stark tartan
dense slate
#

it's just a screenshot from a website

stark tartan
dense slate
#

it's a screen shot

stark tartan
long jackal
#

well now its not centered somehow but close

#

is it from top left corner?

dense slate
#

There ya go. 🙂

long jackal
#

thats not the center tho

dense slate
#

Maybe there's a margin/padding somewhere.

long jackal
#

oop yes there is

#

thank you for the help

dense slate
#

Sure thing.

opaque rivet
long jackal
#

how can I move a button (<a> tag) 5 pixels down when I hover over it? This is what I tried

.quickplay:hover {
    transform: translateY(5px);
}
dry obsidian
#

I want to get into web developpement. I'm planning in learning django. I'm fine with backend and stuff but the only problem is front end because I'm not very creative

#

Is there some sort of drag and drop app for html and css

versed python
#

But it you want to get good at this, you'll have to eventually learn them and practice

dry obsidian
#

Ok thx I'll check them out

mystic wyvern
#

I have a website with a (react) frontend and (laravel) backend. I use axios for react so I can do CRUD Methods easily, but when I do a POST Method from an HTML form to the laravel api it shows this error (419 unknown). I saw some solutions but it was for laravel-react apps like the react library inside the laravel framework and they used blade.php to solve it, but thats not the case for me, I am hosting the laravel api and making CRUD from react just like a public api

mint folio
mystic wyvern
#

@mint folio
How to pass a csrf token with the request and do I pass it in (axios) or in (laravel)

#

In addition, in postman the POST Method works fine with a token, it also worked when I POST it for the first time with axios (if this helps)

mint folio
#

Maybe this server is not best place to ask, for Laravel

dusk portal
#

anyone's up

#
app_name='users'

urlpatterns = [
    path('register/',views.register,name='register'),
    path('login/',v_views.LoginView.as_view(template_name='users/login.html'),name='login'),
    path('order_history/',views.order_history,name='order_history'),
    path('logout/',v_views.LogoutView.as_view(template_name='users/logout.html'),name='logout'),
    path('password_reset/',v_views.PasswordResetView.as_view(),name='password_reset'),
    path('password_reset_done/',v_views.PasswordResetDoneView.as_view(),name='password_reset_done'),
    path('password_reset/<uidb64>/<token>/',v_views.PasswordResetConfirmView.as_view(),name='password_reset_confirm'),
    path('password_reset_complete',v_views.PasswordResetCompleteView.as_view(),name='password_reset_complete')

]```
#

@elder nebula u pro here wow

elder nebula
#

path('password_reset/<uidb64>/<token>/',v_views.PasswordResetConfirmView.as_view(),name='password_reset_confirm'), oh you have it here

dusk portal
#

;-;

#

so whats the issue

elder nebula
#

The problem is the app_name='users', which means django can't find the right reverse.

#
path(
    'password_reset/<uidb64>/<token>/',
        v_views.PasswordResetConfirmView.as_view(
            success_url=reverse_lazy('users:password_reset_complete')
        ),
        name='password_reset_confirm'
    ),
#

and import the from django.urls import reverse_lazy

#

you might also need to fix the other password views

dusk portal
#

ohh

#

umm

dusk portal
elder nebula
#

yes

dusk portal
#

ohk done

#

imported now

elder nebula
#

it works?

dusk portal
#

umm so i need u remove

#

app_name

elder nebula
#

no

dusk portal
#

so

#
from django.urls import path
from . import views
from django.contrib.auth import views as v_views
from django.urls import reverse_lazy


app_name='users'

urlpatterns = [
    path('register/',views.register,name='register'),
    path('login/',v_views.LoginView.as_view(template_name='users/login.html'),name='login'),
    path('order_history/',views.order_history,name='order_history'),
    path('logout/',v_views.LogoutView.as_view(template_name='users/logout.html'),name='logout'),
    path('password_reset/',v_views.PasswordResetView.as_view(),name='password_reset'),
    path('password_reset_done/',v_views.PasswordResetDoneView.as_view(),name='password_reset_done'),
    path('password_reset/<uidb64>/<token>/',v_views.PasswordResetConfirmView.as_view(),name='password_reset_confirm'),
    path('password_reset_complete',v_views.PasswordResetCompleteView.as_view(),name='password_reset_complete')

]``` this is my code rn
elder nebula
#

replace the ```py
path('password_reset/<uidb64>/<token>/',v_views.PasswordResetConfirmView.as_view(),name='password_reset_confirm'),

with the
```py
path('password_reset/<uidb64>/<token>/',v_views.PasswordResetConfirmView.as_view(success_url=reverse_lazy('users:password_reset_complete')),name='password_reset_confirm'),
dusk portal
#

ohh

#

same error @elder nebula

elder nebula
#

hmm

dusk portal
#

Reverse for 'password_reset_confirm' not found. 'password_reset_confirm' is not a valid view function or pattern name.

elder nebula
#

did you close the server and run it again?

dusk portal
#

yes

elder nebula
#

also

path('password_reset/',v_views.PasswordResetView.as_view(),name='password_reset'),

replace with

path('password_reset/',v_views.PasswordResetView.as_view(success_url=reverse_lazy('users:password_reset_done')),name='password_reset'),
dusk portal
#

yes yes

#
app_name='users'

urlpatterns = [
    path('register/',views.register,name='register'),
    path('login/',v_views.LoginView.as_view(template_name='users/login.html'),name='login'),
    path('order_history/',views.order_history,name='order_history'),
    path('logout/',v_views.LogoutView.as_view(template_name='users/logout.html'),name='logout'),
    path('password_reset/',v_views.PasswordResetView.as_view(),name='password_reset'),
    path('password_reset_done/',v_views.PasswordResetDoneView.as_view(),name='password_reset_done'),
    path('password_reset/<uidb64>/<token>/',v_views.PasswordResetConfirmView.as_view(success_url=reverse_lazy('users:password_reset_complete')),name='password_reset_confirm'),
    path('password_reset_complete',v_views.PasswordResetCompleteView.as_view(),name='password_reset_complete')

]```
#

this is my code rn

#

ohh

#

wait doing

#

still

#

lol

elder nebula
#

hmm

#

can you screenshot the screen now

#

error

dusk portal
#

ohk

elder nebula
#

ohh I see it

dusk portal
#

hmm

elder nebula
#

change it to users:password_reset_confirm

dusk portal
#

ohh

#

but i dont have this template

elder nebula
#

hmm

dusk portal
#

but wait

#

umm

elder nebula
#

you don't?

dusk portal
#

if u see my urls

#

u can see name

#

i dont have any url named with

#
change it to users:password_reset_confirm
``` this
elder nebula
#

what about this path('password_reset_complete',v_views.PasswordResetCompleteView.as_view(),name='password_reset_complete')

#

name="password_reset_complete"

#

and the app_name is the prefix

fast yoke
#

guys

#

i got a question

#

this is my utility class:

#
.flex {
  display: flex;
}

.flex-y-center {
  align-items: center;
}

.flex-x-center {
  justify-content: center;
}
elder nebula
#

@dusk portal One solution is to override the file with your own template

fast yoke
elder nebula
#

like this:

path('password_reset/<uidb64>/<token>/',v_views.PasswordResetConfirmView.as_view(template_name="password_reset_confirm.html", success_url=reverse_lazy('users:password_reset_complete')),name='password_reset_confirm'),
elder nebula
dusk portal
elder nebula
#

because you have the reverse prefix users

#

as app name

#

otherwise django don't know which app to reverse to

elder nebula
#

if it works, I think go for it

fast yoke
#

and there are a few more bytes it has to read

elder nebula
#

ohh I get you

#

So you want to center div?

fast yoke
#

xD

#

its a utility class

#

es

elder nebula
#

If you don't find any better solutions, I don't think few bytes of data doesn't make a big difference

#

and also that's not that much of DRY

fast yoke
#

yeah but i want dry

elder nebula
#

then make different class for every use case you need. No need to seperate them

fast yoke
midnight dock
#

Hi guys! I am new to web development and just finished a book about web development with django. Which IDE are you using? The book (written early 2021) used Pycharm Community, but i cannot even get started and supspect django functionality has been moved to the professional version of pycharm...

elder nebula
#

I use visual studio code for django, but also good IDEs are sublime text and atom ect

midnight dock
#

OK, thanks @elder nebula !

elder nebula
#

You should be able to write django with community version of pycharm

#

I think

dense slate
#

I would recommend vs code as well.

midnight dock
#

It seems like they made it a bit harder in the community version, but it should work according to forum threads. I'll give visual studio a go, seems to be easier to find youtube videos for it

#

Thanks Demi

modest scaffold
#

heroku no worky

split steeple
vestal hound
#

Professional just gives you additional integrations that may be helpful

hard summit
#

anyone know css lol

vestal hound
hard summit
#

que

#

?

vestal hound
#

just post your question.

hard summit
#

how tf is that gatekeeping

#

🤔

split steeple
vestal hound
#

it's all Python

split steeple
#

Gotcha, thanks for the correction

vestal hound
#

I use Professional now and there's a Django starter project that you can use

#

perhaps for Community you can't do that

#

and need to set up the project manually

#

which is a inconvenience, definitely

vestal hound
#

because they might not be if you change flex-direction

pure pollen
#

Hi, I'm looking for some assistance with my existing eSports web platform. Is there anyone that's interested in this? https://level.gg

native tide
#
from flask  import Flask
from flask import request
import base64
import json
#return json.dumps(params)

app = Flask(__name__)

@app.route('/api/login', methods=['POST'])
def getloginData():
    email = request.values.get('email')
    password =  request.values.get('password')
    print(email, password)
    logindata = {
        'email': base64.b64decode(str(email)),
        'password': base64.b64decode(str(password)),
    }
    return json.dumps(logindata)


if __name__ == "__main__":
    app.run(debug=True)```
```py
import requests

r = requests.post('http://127.0.0.1:5000/api/login', data = {'email': 'am9obmRvZQ==', 'password': 'MTIzNA=='})
print(r.text)```
opaque rivet
slim vigil
#

so i dont know shit about webdev

#

flask or django at least

opaque rivet
slim vigil
#

and how well does it work with CSS

opaque rivet
#

sends the data as a JSON string.

slim vigil
#

if at all

#

or HTML

#

by it i mean python webdev frameworks

opaque rivet
# slim vigil or HTML

CSS styles HTML which is a concern of the frontend. Flask / Django are backend frameworks.

slim vigil
#

makes sense

native tide
#

yeahh

#

It works without the base64

topaz widget
#

Website in Chrome version 90:

#

Website in Chrome version 92:

#

Same exact CSS!!!

split steeple
long jackal
#

I am adding 2 more buttons, "browse games" and "visit forums". Where is the best place to add them? and also what is there to improve in this page?

native tide
#

Hi there!
i would like to write a django model field for user ids....i want it to generate numbers automatically but i want it to have five digits e.g.
00001
00002
... (continuing)
02345
...
99999
can someone help me out, i'm a beginner
we usually don't write the id field, but it's set to bigauto type so is their another typefield i should be using?

native tide
#

Can I use Django to allow users to download a zip file?

versed python
#

If it is really required you can always define a custom field and change the to_python method to do it.

versed python
native tide
versed python
versed python
versed python
native tide
versed python
#

Ohh

#

Use a property

#

Wait lemme start up my laptop

native tide
native tide
versed python
#
user_1 = UserModel.objects.get(id=1)
user_1.get_role # should give A00001
native tide
placid sapphire
#

hey, putting this here as this is for a website i am doing. i need to get rid of the ['']. i am very new to python this is my first project in it.

versed python
#

on line 13

placid sapphire
#

tried that, it's out of range

#

this is my complete format

versed python
#

what output do you need?

placid sapphire
#

without the ['']

elfin wind
#

anyone have any idea to work out this next_id
I think i need sth to access the value of song_id to add it with 1

versed python
eternal blade
eternal blade
elfin wind
#

yes, it gives my songs value from 1 onwards

#

so i want to acess the next_id of a certain song

#

if a song has id 1
then next_id should be 2

eternal blade
#

You don't need the song_id field

eternal blade
elfin wind
eternal blade
#

You dont need it

#

Models have a id field by default

#

You can do Song.id

elfin wind
eternal blade
#

starting from one

elfin wind
eternal blade
placid sapphire
elfin wind
placid sapphire
#

aka just deleting the string [, ], and '

rustic sky
#

I want to start displaying something on my templates on and past a start date. I have a model with a start date variable... now I just need to figure out how to compare the date from an object to the current date.

I learned about this... is this correct?

@property
def has_started(self):
    return utils.timezone.now < self.start_date```
haven't tried this yet... going to
#

does not work. I'm not sure how to do printing or logging from a running django environment yet either

versed python
#

it should work

rustic sky
#

turns out I can't use it
TypeError: can't compare datetime.datetime to datetime.date

I'm only comparing to date... no time, so

versed python
vestal hound
rustic sky
#

now the < > is what is confusing the crap out of me just by looking at it

#

between the two variables

#

if I'm interpreting it right:

utils.timezone.now().date() > self.expiration```
means... if today's date is later than the expiration date
#

expiration is another property I have

#

and I guess this will be for the start

utils.timezone.now().date() >= self.startdate```
If today is is the start date, or if the start date has already passed
#

right?

#

yep, that's what it is

#

that is confusing to look at man

vestal hound
#

@rustic sky just read > as "after"

#

and < as "before"

rustic sky
#

yeah

#

I'm gonna put that in comments lol

#

now, for django template language, how would I do more than one ifs?

#

if this is true, and something else is false, then go

#

past start date but not expired

vestal hound
#

in your view

#

as far as possible

rustic sky
#

I guess a really messy way is (if a message expires, don't show?)

{% if SysMessage.0.is_expired %}```
I don't like the look of that though
rustic sky
vestal hound
#

your view renders a page

#

from the template

#

right?

rustic sky
#

yes

#

hm, alright then

vestal hound
#

complex logic

#

should not be in the template

rustic sky
#

lol, I figured

#

so that means maybe I may not have to have those properties then 🤔

#

@stark storm I think you posted that in the wrong place

stark storm
#

a

#

@rustic sky Мне не жаль, что я положил его в нужное место, мой вельвет

rustic sky
# vestal hound complex logic
@property
    def is_showing(self):
        return ((utils.timezone.now().date() >= self.start_date) == True & (utils.timezone.now().date() > self.expiration) == False)```
this looks like it'll work. Looks somewhat hacky
stark storm
#

Что это?

stark storm
#

oo-

vestal hound
#

for that matter, you want and, not &

rustic sky
#

lmao

#

forgot if I use and or &

manic frost
#

@stark storm Don't post memes in an on-topic channel, and please only use English on this server. You might want to re-read our #rules and #code-of-conduct

stark storm
#

Извините за беспокойство, я думал, что этот сервер русский...

inland oak
#

I wonder how could it be mistaken for rus speaking server 🤔

stark storm
#

@rustic sky Из того множества, что есть, мы явно можем запутаться

#

Ну, я больше не беспокоюсь, я выйду

inland oak
#

this phrasing makes no sense in russian. perhaps that's not real russian language

#

all word engings are wrong, not the right syntax of the phrase at all

#

perhaps it was made with translator

#

rough attempt to make sense:

Krys:
with keeping in mind available set of ???, we surely can get confused
I will not bother you any longer, I am going to exit
rustic sky
#

hm, alright

#

anyway

rustic sky
#

wait, I feel stupid

#

or not

#

yeah, I'm confused

vestal hound
rustic sky
#

oh, whoops

vestal hound
#

and if x == False is just if not x

rustic sky
#

lolol

vestal hound
#

but

#

in this case you have like if x > y == False

#

which, assuming a total ordering, is reducible to if x <= y

rustic sky
#

the thing with the start date is... making it so that if it starts on that date, it returns True

#

oh

vestal hound
#

for that matter

#

you can consider

#

defining a separate between function

#

because that's kind of what you have, right

rustic sky
#

right.... trying to shorthand things tbh

#

maybe not the best looking ngl

vestal hound
#

if you don't want to do that

#

at least

#

extract the date

#

into a separate variable

rustic sky
#

yeah that's probs best

#
def is_showing(self):
        today_date = utils.timezone.now().date()
        return ((today_date >= self.start_date) and not (today_date > self.expiration))```
vestal hound
#

like I said

#

you can replace

#

not

#

with <=

rustic sky
#

oh

#
return ((today_date >= self.start_date) and (today_date <= self.expiration))```
that looks somewhat confusing
#

oh right,

return ((today_date >= self.start_date) and (today_date <= self.expiration))
# > = after, < = before```
#

that'll help

#

uh, whoops

#

fixed that

vestal hound
#

you don't need

#

all the parentheses

#

also

#

and I would say that "today" implies "today's date"

#

normally I use today for dates

#

and now for datetimes

rustic sky
#

I was worried today would interfere with something (it doesn't)

#

not sure why, so nevermind

#

well, I think that's all, so thank you

#

that was kind of fun, ngl

#

Python can be fun sometimes for sure

long jackal
#

why can't I change the x padding of the title

.title {
    color: white;
    border: 2px solid gray;
    background-color: black;
    border-radius: 30px;
    text-align: center;
    padding: 0px -100px;
    margin: 50px 0px;
    font-size: 100px;
}
    <div class="page-content">
        <h1 class="title">PlaySky</h1>
    </div>
#

it fits the whole screen

next comet
#

im not sure that padding is able to be used with negative numbers

#

i think it's possible only for margin

dusk portal
#

anyon'es up

#

i need help

copper tree
#

Flask-SocketIO: how to pass a variable from app.route to socketio.on?

long jackal
native tide
#

how can i use an app view function on another app (i think it can be done right?)

native tide
long jackal
#

how do I deploy my website?

#

I want to have a domain for it to share to some friends

dusk portal
vestal hound
eternal blade
dusk portal
#

bro u created yt clone but how u made feature of adding videos wow bro , keep it up u r my inspiration @eternal blade

eternal blade
#

Thanks 😄

dusk portal
dusk portal
eternal blade
native tide
dusk portal
#
app_name='users'

urlpatterns = [
    path('register/',views.register,name='register'),
    path('login/',v_views.LoginView.as_view(template_name='users/login.html'),name='login'),
    path('order_history/',views.order_history,name='order_history'),
    path('logout/',v_views.LogoutView.as_view(template_name='users/logout.html'),name='logout'),
    path('password_reset/',v_views.PasswordResetView.as_view(),name='password_reset'),
    path('password_reset_done/',v_views.PasswordResetDoneView.as_view(),name='password_reset_done'),
    path('password_reset/<uidb64>/<token>/',v_views.PasswordResetConfirmView.as_view(),name='password_reset_confirm'),
    path('password_reset_complete',v_views.PasswordResetCompleteView.as_view(),name='password_reset_complete')

]```
native tide
native tide
#

maybe is that ?

eternal blade
#

Looks like the password reset view is trying to link a URL pattern named password_reset_confirm which doesn't exist

dusk portal
#

is there any other way for reset password

#

leaving this?

#

ig it's the only 1 and best

#

and we can add template_name also

#

so it's op

dusk portal
#

this is auth cez

#

my main app urls

#
urlpatterns = [
    path('admin/', admin.site.urls),
    path('',include('index.urls')),
    path('auth/',include('users.urls')),
]```
eternal blade
#

Try specifying the success URL in password reset

dusk portal
#

umm

#

what u mean

#

can u give code

dusk portal
eternal blade
#
v_views.PasswordResetView.as_view(success_url=reverse_lazy('users:password_reset_complete')
#

Try that

dusk portal
#

ohhk

elder nebula
#

do you mean view from another app's views.py?

dusk portal
#

damn bro

#

i still cant fix bro @elder nebula

#

;-;;

#

can i stream it in any vc

elder nebula
#

did you create the custom pages?

dusk portal
#

wait 1 min

#

i will

#

done

#

@elder nebula

#

but same issue

elder nebula
#

Did you build it according to docs or did you use a tutorial?

dusk portal
#

wait lemme show

#

i have to wrap django in this week

#

from sunday

#

django rest framework

#

if i create any user by my register form it stores password like this so i am not able to login but if i create user through django admin then i can login damn bro

#

@elder nebula

#
def register(request):
    if request.method=='POST':
        first_name=request.POST.get('first_name')
        last_name=request.POST.get('last_name')
        email=request.POST.get('email')
        username=request.POST.get('username')
        password1=request.POST.get('password1')
        password2=request.POST.get('password2')
        print(password1)
        if password1==password2:
            if User.objects.filter(username=username).exists() and User.objects.filter(email=email).exists():
                print('Already taken')
            new_user=User(first_name=first_name,last_name=last_name,email=email,username=username,password=password1)
            new_user.save()
            return HttpResponseRedirect('/')
    return render(request,'users/register.html')
#

it also prints the password see

#

xyz12345

#

;-;

elder nebula
#

You should be using django's UserCreationForm to create the users.

dusk portal
#

ik that

#

but in that

#

we cant add own html

#

this method is good

elder nebula
#

ok so create forms.py and use cleaned data at least

dusk portal
#

but in that we cant customize our form fully we can only use things like crispy forms bootstrap

dusk portal
#

is it necessary to use that forms of django cez ig it's not a good way

elder nebula
#

so the content is made put to consistent format

dusk portal
#

umm

#

to be frank im fed up now

elder nebula
#

Use this CustomUserCreationForm

dusk portal
elder nebula
#

for example

dusk portal
#

from django.contrib.auth.models import CustomUserCreationForm

#

same

#

sad lyf!!

#

fixed that @elder nebula

#
def register(request):
    if request.method=='POST':
        first_name=request.POST.get('first_name')
        last_name=request.POST.get('last_name')
        email=request.POST.get('email')
        username=request.POST.get('username')
        password1=request.POST.get('password1')
        password2=request.POST.get('password2')
        print(password1)
        if password1==password2:
            if User.objects.filter(username=username).exists() and User.objects.filter(email=email).exists():
                print('Already taken')
            new_user=User.objects.create_user(first_name=first_name,last_name=last_name,email=email,username=username,password=password1)
            new_user.save()
            return HttpResponseRedirect('/')
    return render(request,'users/register.html')
``` its rule of django when we save anything in  user we should do
#
            new_user=User.objects.create_user(first_name=first_name,last_name=last_name,email=email,username=username,password=password1)
#

not

#

new_user=User(first_name=first_name,last_name=last_name,email=email,username=username,password=password1)

#

Op !!!

elder nebula
#

You shouldn't handle passwords with request.POST.get

dusk portal
#

ohh

#

so?

elder nebula
#

it's unsafe

dusk portal
#

ohh

#

so what should i do

elder nebula
#

You should use django provided methods for password handling

#

I think this is very good tutorial on how to create what you want

dusk portal
#

ohh

#

ok going to watch it rn

#

bro in this he's using django forms and django forms are like we cant edit fields inside it @elder nebula

#

for example

#
  
{% extends "blog/base.html" %}
{% load crispy_forms_tags %}
{% block content %}
    <div class="content-section">
        <form method="POST">
            {% csrf_token %}
            <fieldset class="form-group">
                <legend class="border-bottom mb-4">Join Today</legend>
                {{ form|crispy }}
            </fieldset>
            <div class="form-group">
                <button class="btn btn-outline-info" type="submit">Sign Up</button>
            </div>
        </form>
        <div class="border-top pt-3">
            <small class="text-muted">
                Already Have An Account? <a class="ml-2" href="{% url 'login' %}">Sign In</a>
            </small>
        </div>
    </div>
{% endblock content %}```
#

here where can i beautify fields

#

and for example i have used tailwind in my base.html

#

so when i will use bootstrap here in crispy

#

trust me it will look

#

ugly

#

too ugly

elder nebula
#

you can use crispy forms when using forms.py and you can also create field manually if you want

native tide
elder nebula
#

good

native tide
#

yeah

#

but now im stuck with another error

#

ModuleNotFoundError: No module named 'crispy_formsdashboard'

#

DAMN THE COMMA

#

IM STUPID

#

i forgot the comma in installed_apps between cryspy forms and dashboard app

mystic wyvern
#

hi ,is it widget tweaks useful in django ?

modest scaffold
#

hi, im trying to deploy a django project through heroku and it isnt working for some reason, im not sure what the error is and what im doing wrong

#

can someone help me with this

eternal blade
#

Check the logs

dusk portal
#

hey @eternal blade i want some suggestions

eternal blade
#

Yeah

dusk portal
#

do u come in vc

#

or should i chat

eternal blade
#

Send it here

dusk portal
#

bro ohk so i have a e-commerce site

#

i have functions in it to add files login sign up logout order history and order and stuff and search bar now i want that user can themself become a seller and sell

#

but i cant get idea umm

#

should i add another type of thing in User for them or i should make other Model for them in db

#

@eternal blade

eternal blade
#

You can use a one to one field

#

Eg: ```py
class Seller(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
products = models.ManyToManyField(Product) # The products the seller will be selling

dusk portal
#

ohh

#

got it umm

#

so u have more ideas? @eternal blade

eternal blade
#

no more ideas for now

modest scaffold
# eternal blade Check the logs

for some reason heroku wasn't picking up on the procfile so i deleted it pushed that change added it back then pushed it again then it finally recognised it

#

a bit strange but it works now

dense slate
#

It should be test.test_title

#
  <p> Test: {{ test.test_title}} </p>
  {% endfor %}```
#

If you iterate over the query, you will be able to handle each individual item with the for loop just fine.

#

The first way you did it was fine, but you had {{ testdata.test_title}} instead of {{ test.test_title}}

#

Yea I don't think so. Go back and try looping over it again.

#

And share the code + error

#

make sure that the object returned from the function is the actual queryset

#

You should be getting an error that shows all this info on your page. Is this Django?

#

Are you in debug=True?

#

Ah right.

#

Yea, maybe flask does it differently then.

#

Are you returning one item or many?

#

Isn't get for a single object?

#

query.all()

#

so filter it

#

query.filter(thing="nameofthing")

opaque rivet
#

because a list is iterable, an object is not.

dense slate
#

A queryset is a list of objects I think.

#

You're returning one object with get

opaque rivet
#

Yes, .get() returns a single object because he's retrieving it with primary key

dense slate
#

so it can't iterate it

#

You're using an incorrect variable.

opaque rivet
#
test_id =1

testdata = Test.query.get(test_id)

looks like me that you are.

#

you're getting the object with pk 1

dense slate
#

so what variable are you looking up by?

#

test_id?

#

so query.filter(test_id=test_id)

#

if it's a varaible

#

just make sure you pass it in correctly.

#

are you sure it's called test_id?

opaque rivet
#

if you pass a positional argument to .get(), it will assume that the argument is the pk. So in this case it retrieves objects with the pk 1.
If you want to specify the argument use kwargs

#

@fair shale show us your model

dense slate
#

He's using filter now because he wants a group of objects.

#

It looks like in flask you might have to do query.filter(Test.test_id=test_id)

#

Just a recommendation, that these are the types of foundational errors that you should be learning to debug by googling a bit first.

#

It'll be a better learning experience for you.

#

Because these are like super basic flask functionality issues.

#

Learning to debug is a skill in itself.

#

Did you do a flask tutorial or two?

#

These would come up in any of them really.

#

Querying should be pretty basic. Try to get those down.

#

It's a skill you learn alongside learning to code.

#

You learn what errors mean, and then how to find errors in your code because of what it tells you.

#

So now you know that that error is telling you that something is wrong with the variable name you supplied.

#

So you know where to look for the issue.

#

At least you hope so. 😄

#

That's a good one to lookup and read about.

exotic cape
#

can someone help me here

#

i'm trying to make a website with flask

#

these are my init and views files

#

init

from flask import Flask

def create_app():
  app=Flask(__name__)
  app.config['SECRET_KEY'] = 'apple'

  #to tell flask there are bleprints containing different views
  from .views import views
  from .auth import auth
  app.register_blueprint(views,url_prefix='/')
  app.register_blueprint(views,url_prefix='/')
  
  return app```
#

views

from flask import Blueprint

#blueprint of app
views = Blueprint('views', __name__)

@views.root('/')
def home():
  return'<h1>test</h1>'```
dense slate
#

that's where the error is

exotic cape
#
from server import create_app

app = create_app()

if __name__ == '__main__':
    app.run(debug=True)```
dense slate
#

Oh sorry, it's in views.

#

ok

#

So it's trying to go to Blueprint.root

exotic cape
#

yeah

dense slate
#

can you print Blueprint?

exotic cape
#

k 1 min

dense slate
#

I don't know how flask works that much so I'm just going to think out loud here.

#

should root be somewhere in your views=Blueprint variable?

exotic cape
#

hmm i think theres something wrong with blueprint itself

dense slate
#

Just print Blueprint, not Blueprint.root

#

Right ok, so it's an object

exotic cape
#

yeah it printed <class 'flask.blueprints.Blueprint'>

dense slate
#

So root isn't part of it.

#

Do you need to set that?

exotic cape
#

yeah i'm looking at a tutorial to set up a flask based website

dense slate
#

link it

exotic cape
#

and its supposed to be using it

#

In this video, I'm going to be showing you how to make a website with Python, covering Flask, authentication, databases, and more. The goal of this video is to give you what you need to make a finished product that you can tweak, and turn into anything you like. We're going to also go over how you create a new user's account, how you store those...

▶ Play video
#

im only like 13 min in

dense slate
#

why are you putting root

#

it shows @views.route('/')

exotic cape
#

ah

#

i may have gotten it mixed up when i was listening to him

#

thnx

dense slate
#

Probably good to look at the code. 🙂

exotic cape
#

lol

#

srry

#

i was looking everywhere except that

stark tartan
#

I want to build notification feature in my social media website can you guys please explain.

which would be best django channels or asynchronous views or any other package.??

dense slate
#

How live do you need it to be?

#

Since a request is made on any page load, you could just request the notifications anytime they changes pages if you need a low-key simple solution.

#

I can't think of anything besides websockets/channels for live updates.

edgy anvil
#

how would i go about deploying my flask application on aws?

#

do i deploy it on elastic beanstalk?

gentle jasper
#

Flask or Django?

calm plume
broken mulch
#

hi guys im building a flask app, im wondering how to pass information to my script.js file

#

or just how to fetch data

gentle jasper
calm plume
#

I'd personally recommend Django for that (although I don't know exactly what you're doing). Django comes included with a wonderful way to interact with your database and so much more good stuff

gentle jasper
broken mulch
#

how do I get backend values in frontend

#

im thinking using axios

dusk portal
#

contact page app

dense slate
edgy anvil
dusk portal
#

i suck at dev ops sorry bro idk

dense slate
broken mulch
# dense slate that works

so like

let password = axios.get(
    "my_url",
    headers: {
      "Authorization": "10RH9428HF98R12984HT"
    }
  );

this would work?

dense slate
#

I don't use axios much so if that's the syntax then maybe, sure.

#

But axios as a tool would work, yes.

broken mulch
#

what do u use

#

in frontend

#

to get backend data

dense slate
#

Apollo client. I use GraphQL so that's what I've been using for a while.

broken mulch
#

i see i'll check that out

edgy anvil
dense slate
#

I don't know a lot about AWS. I usually use DO. So I don't know either, but it all should depend on what you need to accomplish.

#

EB probably has a purpose. If you need it, use it. See what the tutorial accomplishes and if that works for what you need.

broken mulch
#

can I use process.env.NAME to access an environment variable

dense slate
#

Uh, usually.

#

Different frameworks can handle it slightly differently.

broken mulch
#

k thanks

dusk portal
#

;-;

#

where's that link

dense slate
#

it was fake

dusk portal
#

lol

#

i also saw

broken mulch
#

axios.get() is using the user's IP address to form the request right?

dense slate
#

Maybe you can check the axios docs.

#

or whatever framework you're using.

broken mulch
#

ok

#

hmmm nothing is working

#

my javascript isn't functioning for some reason

#
<script>
    console.log("hi")
</script>

even this won't work

faint summit
#

hi all. do most of the pals use flask with boostrap? i see from the tutorials, all use it with that tool, not a static css

lost heath
#

Does anyone know how to post this?

#

Like what format

silent depot
lost heath
silent depot