#web-development

2 messages · Page 157 of 1

graceful flax
#

Using django and postresql

#

Could anyone here share their experience with Django Channels and android especially

#

On how to go about it, thanks! There isn't much info online on channels with android needed some guidance

versed python
#

Django channels is meant to be run on your backend server. There's noting android specific about it.

#

Websockets may be more like what you are looking for even though they are not really android specific as well.

graceful flax
#

Yes, so I connect a websocket

#

Yea, I can setup the backend, wanted to know how I'd connect them

versed python
#

I don't have any experience with android development but you should probably look up how to use websockets in android applications.

#

Don't mix up your backend and frontend, they will only be communicating, they are not interdependent.

graceful flax
#

Okay yes, thanks!

native tide
#

okok my bad 😅

toxic forge
#

<@&267628507062992896> I have one question recently i have developed one blogging website using Django and made open-source the complete development.
Can i share the walkthrough video/github repository link here if it's allowed?

Please let me know.

river raven
#

Please DM @hexed spoke with the details of your project

native tide
#

Can you make a forum with just purely HTML and CSS?

calm plume
#

Probably not. You would need something like js to make it reactive and you'd need a backend too

native tide
#

or do you need something like JavaScript

#

oh

#

can you use java for web devlopment

#

instead of js

calm plume
#

No, java is not a web development language

opaque rivet
#

sure. It's nothing special, but I actually don't know the use of containerizing the React frontend. If you have seperate containers, how will the server return HTML pages to then be hydrated?

iirc django needs access to the bundled .js files created by say create-react-app or next.js to hydrate those pages too. So running them in seperate containers will be hard if they do not have access to eachother's files.

calm plume
#

Pretty sure dockerizing is just good because with a simple docker compose up, your program can run

#

Well, assuming you're using docker compose

opaque rivet
#

yeah, I just don't see the point of having your frontend and your backend in different containers... Let's say that your backend had the filestructure:

/frontend
/app_1
/app_2

In your dockerfile (for your backend) you'd copy all of the files of this project into your container:

COPY . .

So then your server can serve your frontend pages. But what is the point of running the frontend in a seperate container, I probably am missing something?

calm plume
#

I'm not sure of a real reason, but here's my take on it. Say someone wants to just work on the frontend, they could do that without launching the backend. Same thing with the backend.

vivid stag
#

This is my entrypoint.sh for a docker based container. It runs everytime docker-compose is started so even the alembic migrations run everytime even if there is no change in the Schema. Is there any way to automate it by making revisions run only when there is a change and ignore the statement otherwise ?

pip install requests
alembic revision --autogenerate
alembic upgrade head
uvicorn app.server:app --reload --host 0.0.0.0 --port 5000
surreal portal
#

Do i really have to use alembic to initialize a table in a database?

inland oak
#

migrations stored in your repository as code changes help really much

#

yes you can as alternative being creating your databases with raw SQL

#

but you will hurt your own project with it

surreal portal
#

Because i'm using FastAPI and I really want a table to be initialized

#

Like, whenever I'm starting my API, I'd like to have a pythonic equivalent of CREATE TABLE IF NOT EXISTS user

inland oak
#

as another way you can use cursor to run CREATE TABLE IF NOT EXISTS user directly, but I highly don't recommend it

#

it complicates not just development, you ruin for yourself organizing easy testing too

#

although testing is part of development, so I should not separate those two words

surreal portal
#

Yeah because i'm pretty much a newbie in migrations. I still need to understand how alembic works

#

I remember a friend trying to initialize a database with a SQL schema using sqlite3 and it's far from being the most optimal solution

inland oak
#

you have already basically setup Alembic and SQLalchemy

#

they are tuned perfectly for you

#

(or at least their alternative)

#

just few settings to switch in order to change sqlite to postgres

surreal portal
calm plume
#

Personally, I would go with PostgreSQL.

inland oak
#

me too

#

PostgreSQL is open source with free license

#

it is more preferable to invest your skills into it

quick cargo
#

Postgres is a solid choice

#

If you're forced to use MySQL you should use MariaDB instead on that note as well

surreal portal
#

Last time i've used MySQL was as a Docker container for a Flask app. Maybe I should use Postgres instead

north aurora
#

Hello Everyone!
I'm trying to create a new user profile whenever a new user is created, with the help of django signals. But its not working as expected. Can anyone tell me why?
Here's my models.py file.

#

'm getting this error when I creates a new user and try to open the new user's profile.

#

Can anyone tell me what should I do now?

calm plume
#

Can you share your css for the box?

#

Ah, idk how to style Flask forms. Sorry

#

But if you do know how to style them, it should be as simple as giving them a width and height

surreal portal
#

BTW can we make microservices with Django?

#

Let's say i want to use Django as a backend service

#

And my frontend is something like React or Next.JS

#

Can I use Django without templating?

inland oak
#

this is whole branch of Django exactly for that

inland oak
surreal portal
#

Nice

#

Maybe I should've used Django instead of FastAPI in case my app grows

inland oak
# surreal portal Can I use Django without templating?

btw, FastAPI is technically more recommended, but I would still recommend Django for a less skilled developers
in my opinion Django is more forgiving to developer skills.

Fast API requires ability to set up at least database from scratch, which is twice harder for real project. And database is usually most important part.
Much more room to make mistakes

#

I think Fast API is good choice after you developed at least several applications, and already experienced python web dev

calm plume
#

They do different things, unless you're referring to DRF

inland oak
#

DRF, link above

calm plume
#

Ah, got it

quasi relic
#

for form.email.label you dont need parentheses and you can you class=“” in form.email() -> form.email(class=“email-input”) like this

surreal portal
inland oak
#

I started from Flask too ;b

#

then tried my hand in Quart

#

and then I made very lucky stumble with Django

#

thinking to try FastAPI one day, may be at the next job

surreal portal
#

My friends told me it was easier to set up a db in Django than with Flask. main reason why they made us work with Flask is for understanding how webdev works on a fundamental level

inland oak
#

I told someone yesterday something like

#

Learn with Flask
Build with Django

#

Although with recent Flask upgrade

#

Flask can become more sweet

surreal portal
#

Does Flask 2.0 support ASGI?

inland oak
#

it should

surreal portal
#

Since FastAPI is built on Starlette I have an easier time than with Flask

inland oak
surreal portal
#

Might be interesting though I'm afraid all the extensions might break.

#

Especially Flask RESTful

inland oak
#

yeah, same thinking

#

that's why I would choose FastAPI for real project

#

Flask 2.0 is too much new)

surreal portal
#

Yeah i'm keeping Flask 2.0 for experimentation

quick cargo
#

fastapi will generally be more performant as well

#

not that it matter much

#

but for rest apis and stuff like that fastapi is king

surreal portal
#

Yeah because right now I'm trying to use it for user authentication

inland oak
#

would it be great for GraphQL as well?

quick cargo
#

can be yes

#

Its a very solid framework

inland oak
#

nice

surreal portal
#

I'm trying to use FastAPI as a backend for requests and session handling

#

Can REST APIs use authentication or should I use another backend component

quick cargo
#

I mean anything can use authentication

inland oak
#

pretty much liking roadmap of backend skills

#

useful to get answers like that quickly

inland oak
#

hmm, for now hehe I use it, until I would learn alternatives at keast ;b

#

JWT is nice for seassion handling

surreal portal
inland oak
#

nice

#

definitely using FastAPI as next framework ;b

#

when I would finish taking my time with Django though

mild zodiac
#

any help is appreciated

quasi relic
#

it is the same way when you make a class attribute for html elements

#

and then you call it in css file

surreal portal
#

Also this is going to sound crazy but can you host a backend on Github pages?

calm plume
#

No, I don't think so.

coarse haven
#

static only

inland oak
#

Btw, what stops from deploying frontend to github pages 😉

#

like react ;b

#

it should be possible in theory

coarse haven
#

you can

fresh sky
#

Hey 👋 Is there anyway to avoid the page refresh every time i send the text values from the form

app = Flask(__name__)

@app.route('/')
def index():
    return render_template(r'index.html')

@app.route('/', methods=['POST'])
def my_form_post():
    text = request.form['text']
    processed_text = text.upper()
    return index()

if __name__ == "__main__":
    app.run(debug=True)
...
    <form method="POST">
        <input name="text" size="75">
        <input type="submit">
    </form>
...
surreal portal
#

According to create-react-app you can

opaque rivet
#

what's the difference between tokens and jwt?

surreal portal
#

i'm trying to build my portfolio with React. It's overkill but at least it shows I can manipulate a demanded framework on the market

coarse haven
#

theres other types

#

anyone could make their own token type and use it

#

but jwt are what we all use

inland oak
#

the thing is... you can have a whole dictionary of data (encoded to JSON), which you transform to token with JWT
So I guess Token is part of JWT usage.

#

we are usually encoding user ID in database / his email into this JSON, in order to verify/identify him after getting the token and decoding it back into dictionary

opaque rivet
#

I heard JWTs are just meant for short-lived requests and something more persistent like token cookies are preferred for authentication

inland oak
coarse haven
inland oak
#

a time of expiration which will prevent decoding it back ;b, once time is out

opaque rivet
#

smart, so jwt's are just normal tokens but JSON, so they can have different parameters

coarse haven
#

if someone says tokens, they 99.99% of the time mean json web tokens

#

theres literally no other 'token' that people talk about

inland oak
#

when encoded they look like one string of mess as usual

opaque rivet
#

mhm

#

guess i'll use this then

inland oak
#

interesting though to try a hand in your found choice

outer apex
# surreal portal Also this is going to sound crazy but can you host a backend on Github pages?
surreal portal
outer apex
fresh sky
#

i'll give it a go thanks for the feedback @outer apex , pretty new stuff for me so hitting a few walls

outer apex
#

That's fair! This Discord group ain't going anywhere so definitely ask on here if you have more questions! 🙂

dusk rose
#

Hello, my question is about Django (the webserver) Models. Is it possible to create a model with a choice list, bur if i send an other string to it it accepts it and expand the choices?

untold cave
#

Hello, I'm new here.. Does anyone know about FLask?

dusk rose
#

What do you want to know?

untold cave
#

Actually I'm creating an app using flask and getting some error which I'm unable to resolve it

#

No module name “flask_mysql”

#

I've installed the lib and env

dusk rose
#

install and import it

untold cave
#

I dont understand where I'm doing it wrong

dusk rose
#

with pip3?

untold cave
#

pip

#

yes

dusk rose
#

using python3?

noble spoke
#

Can you show us code

#

Or well, your terminal i guess

untold cave
#

yeah python 3.7

#

sure

noble spoke
#

Are you using a venv?

untold cave
#

yes ive created an env

#

which voice chat shoulod i join?

noble spoke
#

Did you actuvate and install deps in it?

untold cave
#

yeah i did

#

i've also installed sql

#

and activated the scripts

dusk rose
#

show us some screenshots

untold cave
#

okay

#

from flask import Flask
from flask_mysql import MySQL

#

Traceback (most recent call last):
File "App.py", line 1, in <module>
from flask_mysqldb import MySQL
ModuleNotFoundError: No module named 'flask_mysqldb'

#

This is the error

dusk rose
#

show the pip installed list

#

please

untold cave
#

ok wait

dusk rose
#

pip3 list

untold cave
dusk rose
#

That is not the output from the env

#

that ist actually your normal python. You shoul activate the env first

noble spoke
#

The package is flask_mysql

#

Not flask_mysqldb

untold cave
#

okay let me install this one

noble spoke
#

Are you using pycharm?

untold cave
#

PIplist of flask

noble spoke
#

Are you using pycharm my guy

untold cave
#

yeah i am

noble spoke
#

Use pycharm's integrated terminal

dusk rose
#

do it the easy way in the settings

noble spoke
#

It should have rhe venv activated

#

You arent using the venv in those screenshots

dusk rose
#

no he dont

untold cave
#

Should I create the env. then install flask. then write the code?

#

in a single folder?

#

I'm a she 😛

dusk rose
#

im sorry

noble spoke
#

You make the venv
You activate it
You install your deps
You run the program

dusk rose
#

should we help you in a screen share with voice chat?

untold cave
#

yes please

dusk rose
#

Voice Chat 1

untold cave
#

okay

dusk rose
#

we are muted in this channels

#

@untold cave

untold cave
#

yeah why?

noble spoke
#

This isnt something that needs voice tbh

#

Do you have a requirements.txt?

untold cave
#

I would have to check

#

I dont have permission to unmute

noble spoke
#

Ok the steps rougly are

py -m venv venv
venv\\Scripts\\activate
pip install flask flask_mysql
#

And then you run the app

#

From the terminal btw

untold cave
#

Let me try that

noble spoke
#

If pycharm already made a venv for you skip to step 2

inland oak
#

hmm, not working the link

calm plume
#

If you can't see that channel, it won't link

noble spoke
#

If youre verified you wont see the channel

#

And you are

inland oak
#

All righty, lets go sneaky
erase space in <# 764802555427029012> to form the link ;b

noble spoke
tender island
#

Hello, im getting an error in my django blog web app. When i click on "New Post" to create a post for user, it gives me this error:

#
<div class="navbar-nav">
                {% if user.is_authenticated %}
                  <a class="nav-item nav-link" href="{% url 'post-create' % post.id }">New Post</a>
                  <a class="nav-item nav-link" href="{% url 'profile'%}">Profile</a>
                  <a class="nav-item nav-link" href="{% url 'logout'%}">Logout</a>
                {% else %}
                  <a class="nav-item nav-link" href="{% url 'login'%}">Login</a>
                  <a class="nav-item nav-link" href="{% url 'register'%}">Register</a>
                {% endif %}
#

on the third line is the post create url path

#

This the layout of the web app

#

any help would be very nice

wicked hare
dusk rose
tender island
wicked hare
#

Seems like it's okay. The problem is on the html

#

Kindly dm

obsidian rose
#

Hey, I'm watching a django course and coding it along, and this fragment took my attention - why does it use slashes that way?
Usually it's a division operator, but I assume it just adds a slash to the newly created url - but why does it even work?

late gale
#

hello mind if i ask what's better for web for data science matplotlib or chartsJs

languid raptor
#

I need something to act as a proxy between Linux Python script and KVM guest instance of Windows. I've created a few Django projects so I'm familiar with the basic REST CRUD, but never had to make an API before.

Simple task. Make a request comprising two parameters: connection string, ie. r'DSN=qremote_dsn;IPAddress=192.168.0.50;Port=4500;RemoteDSN=login_dsn;OpenMode=F;OLE DB Services=-2;' and SQL-syntax query string. ie. SELECT name FROM users. After query executes, I will get back a JSON-like dictionary, or other messages from pyodbc.

Looking at FastAPI I feel this is overkill. Can I use Gunicorn directly in some way? Other ideas?

dense phoenix
#

How do I have a custom url for flask?

lusty solar
#

Looking for someone to help me with web design. Take around 1 till 2 hours priv.

primal sluice
languid raptor
#

Overkill for what I need. I'm not adding an API to a resource, but using an API as a bridge between Python script and script in KVM guest

#

which itself has the ODBC resource

#

I'm just saying I don't need all the normal CRUD operations you get form REST framework, which is all the stuff that FastAPI is making easy

opaque rivet
#

Maybe use Starlette (what fastAPI is built upon?)

languid raptor
#

Does the idea of making an "API" to bridge the gap between python script running in Linux to a KVM guest running Windows so I can get to the Windows ODBC data sources sound like it is best solved by an 'API'?
If one-line description is unclear to the problem I am trying to work around the background is here: https://unix.stackexchange.com/q/647069/9494

#

It has a picture, too 🙂

surreal portal
lusty solar
soft tangle
#

Hey
I want to build a website wich can stream audio from client to server and into a „virtual Microphone“ and then i need to stream audio back to the client..

languid raptor
opaque rivet
languid raptor
#

"API would be the best option" Its the only suggestion I've received (so you're in good company). Well, the first suggestion was to create the virtual Windows system inside Linux. Haha. So either direction I still have this same bottleneck, and the answer so far is an "API". Funny, the first time I asked this question on SO, I thought I needed to use Requests to create the "API". I'm learning!

surreal portal
lusty solar
#

Soo like my picture is next to my text with the link on

#

How do I get my picture above --

jade lark
languid raptor
#

Is there a particular Python amazing magical package which makes sockets painless and all that jazz?

#

that comes to mind?

jade lark
#

I don't have enough experience with it to recommend anything sadly.

#

You can also always look at SSH (depending on your use case there again)

#

Knowing what you're trying to accomplish could help me possibly recommend something else.

languid raptor
jade lark
#

Already looking at it 😛

languid raptor
#

Originally I was doing Python script in Windows from (A) to the ODBC data source

#

Once I moved the script to (B), I learned after this post that PyODBC can't make the leap

#

So right now API, or possibly Sockets go into (???) and would talk on route (C) to (B)

jade lark
#

Either of those options are fine there is no right or wrong answer. It's whatever you're comfortable and okay with.

languid raptor
#

Certainly. It

#

's really is a set it and forget it. So whatever turns out to be the least maintenance and the easiest and smallest to run in the KVM guest instance of Windows will be the winner

jade lark
#

If you're running an API you will most likely need to do it on every single server as it would need to almost be like a microservice setup.

#

With each being able to receive requests and perform the required action after.

#

with sockets you would have the clients and server. Which would probably be easier to manage.

languid raptor
#

The project is an Intranet site with a bunch of Python scripts deployed through Django. Only one server right now (^_^)

I will have to investigate the Sockets option. It's the first I've heard it mentioned, so I'm grateful to you for suggesting it. That's really why I brought the question here to Discord. To poll for options so I can learn what I don't know. I'm sure once I start the research I'll recognize what you say makes it easier to manage.

jade lark
#

If you're already running a Django server for it then you might not want to touch sockets as integrating can be a bit harder.

Is a client requesting something on the django site that will start a chain of events on the backend?

prisma ferry
#

so im building a website and i wanna transfer info from my back end to my front end. anyone knows what i can do?

#

im using flask

languid raptor
# jade lark This is a very basic article: https://shakeelosmani.wordpress.com/2015/04/13/pyt...

I currently have a handful of Click CLI scripts. This was great for a start, but there are limitations.

I'm reading the Socket tutorial and found what I've been reading for several hours (edit: on FastAPI and Starlette) trying to find:

"Then we print the clients address and create another variable data which is receiving data from connection and we have to decode it, this step is necessary for Python 3 as normal string with str won’t pass through socket..."

The fact this is mentioned--and in bold no less--gives me the idea I'm on the right track. haha

#

Just out of the box testing, all of my connection strings (for PyODBC and SQL) were borked.

#

"If you're already running a Django server for it then you might not want to touch sockets as integrating can be a bit harder."

I take this to mean if I was trying to integrate my script and socket call through django? Otherwise, can the coexist? The Python scripts are run from inside View functions, but AFAICT they run just like normal python scripts.

jade lark
languid raptor
#

It's blocking the view function

jade lark
#

Yeah, don't want to do that then.

languid raptor
#

don't cross the streams, huh?

jade lark
#

It wouldn't work well is all. Think of if you had that task taking like 5 minutes.

#

That thread/worker would be blocked that whole time.

languid raptor
#

Oh! You mean blocking because it ties up the server. No the scripts run in < 30s. Otherwise I'm working to figure out Celery for overnight. Block all it wants

jade lark
#

Will it always run in under 30s?

#

Even in the future

languid raptor
#

Well. Its a work in progress. I suppose you could make a request that would be so large as to jam up the whole server. And I'd love to hear why that was necessary from my colleagues.

opaque rivet
jade lark
languid raptor
#

Django is just the front end replacement for CLI

languid raptor
#

It supports the scripts, which are really just ported over, and right now what they return is ..

jade lark
#

Okay, well. I wouldn't trust them on it as stuff always happens. If you're deployed with nginx or something your requests will also timeout after 30 seconds (unless configured for nginx and the workers)

#

In that case I would use celery (it should only take about 20min to integrate). Then you can fire off a task and have it return right after.

jade lark
# opaque rivet could you elaborate?

async_to_sync/sync_to_async You have to switch threads constantly. It would effect the whole server for any other functionality running through Django.

languid raptor
#

files saved to server. Then I put those file references into the model form so I can manage the files through Django.

It also returns messages which are then put into the Django messages GUI.

jade lark
#

Once the task is completed then you can return the response from the task. You can also use Django models with Celery.

languid raptor
#

Yes. This is the dream. First I was thinking Celery Cron jobs to run overnight. What I know about JS you can stick in your eye and still see good, so that level of front end is @FUTURE

jade lark
#

It's not too bad

#

you can use fetch or axios

#

If you're wanting cron jobs too then celery would work perfectly.

opaque rivet
jade lark
quick cargo
#

That likely wont be for a whileeeeeee

#

Django is so massive it's incredibly hard to rewrite

jade lark
quick cargo
#

The amount of work it took to get Channels working was more than what most applications even come close to in terms of design

languid raptor
#

All the celery packages and databases were installed. This was one of my early requirements, but then the projects I was porting over were changed in priority and those tasks were back burner.

Just to be clear about the Sockets issues:

  • sockets which are blocking in a Django loop (like view function) would be problematic in all the normal ways of having Django tied up waiting for the script to return.
  • other issues if I try to integrate sockets into Django (like using Djongo for MongoDB which can be used instead of PostGRES)
prisma ferry
#

so im building a website and i wanna transfer info from my back end to my front end. anyone knows what i can do?

jade lark
languid raptor
prisma ferry
#

im using flask currently

#

but i wanna create a login and when you login, the back end will fetch some info from a db and display it onto the website

#

so its not gonna be the same for everyone

languid raptor
prisma ferry
languid raptor
#

I was just making sure I can use sockets without integrating with Django or having to deal with that

jade lark
opaque rivet
#

so, if you have synchronous middleware - why does that give you a performance hit? wouldn't it just be "blocking" until the request reaches the view - so no slower than the usual wsgi server?

prisma ferry
jade lark
prisma ferry
opaque rivet
#

so switching from sync -> async (vise verca), how does that occur do you know?

opaque rivet
#

alright thanks. i really want to learn about wsgi/asgi and their differences. if you guys have any good resources please let me know 🙂 i think fastapi is my next venture

jade lark
languid raptor
#

i think fastapi is my next venture

You can have it! haha I'm using Sockets or Starlette

opaque rivet
#

so I guess django would be the best option generally, but I'm only using it as an API and that's about it

jade lark
#

One thing I am waiting on is SQLAlchemy to be out of beta for async. Or else you're going to still have the same kind of issues with FastAPI as with Django. (To my knowledge anyways). Tortoise ORM is not well supported yet nor is it production ready

opaque rivet
#

yeah currently using that, with channels + celery. maybe I'll give a deeper read into wsgi/asgi differences before I make a decision

#

for employability i should've probably chose express.js or spring boot tbh

jade lark
jade lark
#

Learn a frontend framework (highly recommend React, even though Vue is easier for a beginner).

opaque rivet
jade lark
languid raptor
#

Streamlit for small widget apps. For something more personalized they recommend Dash with Plotly. Although it’s possible to use Python as a backend for the data, then use something like D3 to publish on a frontend

#

For my part I'm just hoping Bootstrap will give me most of what I want

opaque rivet
#

man D3 was a pain for me

#

I just used react-apexcharts and it worked decent

jade lark
#

It's how I started

languid raptor
#

For me I started with the laundry list of hot things to learn, but I never was able to convert that. Now its all about organic. I learn it when I need it. Borrow it if it's not important, and learn it when out of the box isn't sufficient. Which happens really quickly with front end. Like I need to take one of my current project forms and in the CLI you can just keep adding parameters, but forms? uuug.

Thats the ZEN of weekend programmer learning to Automate the Boring Stuff. ahah

#

Now I've been trying to finish something so I can quit for the night and this discussion has been to fantastic for me to step away. But now I've got to finish. Most excellent discussion. Tx peeps.

#

bye for now

jade lark
#

No worries! Best of luck hope you get it figured out.

prisma ferry
#

hello

solemn glacier
#

hi

prisma ferry
#

wasup

glacial stone
#

Someone can help with django? I'm a beginner in django

#

I need to consume api for a homework

prisma ferry
#

cant help u there mate

#

i only knoq flask

vestal hound
#

don't ask to ask

vestal hound
#

React is very popular though

glacial stone
calm plume
lusty solar
#

How do I center my text, Its in the center. But I want it in the middle

limpid cave
#

Hey guys I seem to bet getting this error, and I can't figure out how to fix it

#

Here's my code

#

I have tried using redirect(request.referrer) and the same error still occurs

#

all my folder are in the correct location

#

has any1 encountered this error?

outer apex
outer apex
limpid cave
#

the backend file is the file for writing the flask code]

outer apex
#

what's in the templates directory? can you share how you're instantiating the Flask instance?

limpid cave
#

It's working now. But it wasn't working for the entire night and when I used redirect and idk why

outer apex
#

right, if you hit /create with a GET request, it's gonna reach render_template(request.referrer). Whatever request.referrer evaluates to, it'll try to find a template with that value as a file name. Obviously you don't have something like http://localhost:5000/ as a file name.

limpid cave
#

I was just trying out different solutions

outer apex
#

👍

limpid cave
#

But I didn't know that so I'll keep that in mind. Much appreciated

tropic otter
#

How do I use a a not equal in django filter?
127.0.0.1?name__ne=chris

woven fern
#

any soln to this django not recognized in venv

surreal portal
#

Hello everyone, I meant to ask something

#

When it comes to private APIs, there's no need for a private domain or making the connection secure with https, is it?

woeful atlas
#

Hi

#

I have this erro: jinja2.exceptions.TemplateSyntaxError: expected token 'end of print statement', got 'guild'

#

in

#
 {% for guild in common_guild %} 
          <a class="dropdown-item" style="background-color: #202225 !important;" href="/dashboard/{{guild.id}}/modules"><p class="text-white px-2"><img class="align-middle icon_player" {{ if guild.icon_url }} src={{guild.icon_url}} {{ endif }}   width="40" height="40" class="d-inline-block align-top" alt=""> {{guild.name[:15]}}</p></a>
        {% endfor %}```
#

why ?

oblique kite
#

hello guys..
pls help me with mysql query..

Table A
id        name        desc
---------------------------------------------------
1        abc        something

2        xyz        something

Table B
id        nameB        descB        tableA(fk)
-----------------------------------------------------------------
1        ghj        something          1

2        jkl        somethingxyz       1

3        sdf        somesdf            2

4        dfg        somedfg            2


Result:
TableA.name   TableB.name - Count(TableB.name)

    abc              ghj - 1
    abc              jkl - 1
    xyz              sdf - 1
    xyz              dfg - 1

TableA.name   TableB.name - Count(TableB.name)

    abc              ghj - 1, jkl - 1
    xyz              sdf - 1, dfg - 1  
proper mural
#

Hi everyone :D
i have a problem about the background of my site
i want to set a picture as my site bg but i cant
can anybody help me ?
i have the wanted picture in the folder of site and i didnt forgot to refresh the site ....

nimble epoch
proper mural
#
<!DOCTYPE html>
<html>
    <head>
        <title>This is the title</title>
        <style>
            body {background-image: image(Insta);}
            h1   {border:black;}
            p    {background-color: blanchedalmond;}
        </style>
    </head>
    <body>
        <h1>This is the first heading</h1>
        <p>This is the paragraph</p>
    </body>
</html>
nimble epoch
#

ok let me try it

proper mural
nimble epoch
#

oh ok

proper mural
#

i want to set it as the whole bg

nimble epoch
nimble epoch
#

yw🙂

proper mural
#

OMG it works Thanks alot bro :DDDD

#

nice picture :)

neat goblet
#

Can someone tell me how can I jump to a specific div in html ?

#

I have div class div class="section mt-5">

#

this div class

#

I want to jump to this div class when I click on a button

#
<a href="#" class="main-2">Deals of the Day</a>```
#

this is the button

hollow mulch
#

try this

<div class="section mt-5" id="section-mt-5">
<a href="#section-mt-5" class="main-2">Deals of the Day</a>
#

@neat goblet

neat goblet
#

thanks man lemme try

#

It worked thanks a lot man

hollow mulch
neat goblet
#

Can you help me with JS as well ? @hollow mulch

hollow mulch
#

yes, what is it?

neat goblet
#

I've created a button just like the one I sent before
I want to do something like if I click a button it adds into a cart

#

so we can sum up and order stuff

neat goblet
#

How can I make my website compatible for mobile phone view?

neat goblet
#

I've these buttons

#

with prize

#

what should I do that if I click any of them I am redirected to a payment page

lost heath
#

can anyone help with this using chromedriver

neat goblet
#

I have to write a herf on each of them

#

?

neat goblet
#

anyone please help me ?

versed python
neat goblet
#

I've fully functional website, can anyone tell me how to add payment gateway in it ? using js?

#

maybe send me the scipt?

calm plume
#

If you want to use something outside of your website, Patreon is an option.

#

If you want to integrate it into your website, Stripe is great.

manic frost
#

stripe doesn't work in all countries, sadly

#

(if it doesn't, you can probably find an alternative)

native tide
#

Can anyone show me example of functions on daily life projects?

calm plume
#

What do you mean by daily life?

cosmic swallow
#

Okey, I have quite a problem I
Does anybody know a way to generate mock webservice server from wsdl/xsd ?

#

I was trying zeep and it's quite good, but I need this as server and i didn't find any way to make zeep act as one

#

I was also trying spyne - as it's creating neat server, but it dosent support wsdl fiels :/

wraith wind
#

helo can somone help me out i have a rly simple question about html css

#

who can help me ?

calm plume
#

Ask away

wraith wind
#

how do i put read me under back to login?

native tide
calm plume
#

What do you mean by "functions"?

calm plume
#

text-align: center; should do it

wraith wind
#

yes

calm plume
#

Assuming the parent class spans across the whole square

wraith wind
#

can i write that in html or do i need to do that in css?

calm plume
#

css

wraith wind
#

oke i will try

native tide
calm plume
wraith wind
#

it did not work

calm plume
#

Both html and css

wraith wind
#

my html code is <div class="ReadMe-button">
<a href="forgotpasswordhelp.html" style="color: white">
</i>Read Me</li>
</a>

#

isnt their a code in html to do the text in the middle under?

calm plume
#

There is, but it's very old and bad practice

calm plume
late gale
#
def complete_order(request):
    if request.method == "POST":
        form = TicketRecieved(request.POST)
        if form.is_valid():
            form.save()
            name = form.cleaned_data.get('name')
            email = form.cleaned_data.get('email')
            qr_code = QrCode.objects.all()
...

and models.py

class QrCode(models.Model):
    name = models.CharField(max_length=100, default='')
    ticket = models.ForeignKey(PaymentForm, on_delete=models.SET_NULL, null=True)
    qr_code = models.ImageField(upload_to='qrcodes', blank=True)
...

can someone please tell me why QrCode.objects.get(ticket.email = email) not working , i want to get the qrcode that ticket.email equals to email please help
This is django

obsidian kettle
#

is this a appropriate channel to ask about selenium?

wraith wind
calm plume
#

Ok, what's the css for both?

obsidian kettle
#
link.click()```
#

but .click doesn't work

wraith wind
calm plume
#

Then how did the first one get centered?

#

Do you have any css at all?

wraith wind
#

it workedd!!! i looked again through the css

#

thnx

late gale
#

i want to get the qrcode that has the ticket email and checks if it equals to email

neat goblet
#

How can I add if condition in html?

#

I've a blank input field

#

I want a condtion if text is in there

#

and you press submit button it says

#

submitted

#

a pop up appears submitted

#

else

#

it tells to fill all the boxes

calm plume
#

What framework are you using?

neat goblet
#

I don't know about js

#

only lil bit basic

#

So can you please help me ?

calm plume
#

Are you using a Python framework?

neat goblet
#

Nope

#

only css and js

#

html and css*

calm plume
#

You could probably do that with css

#

Or some basic js

neat goblet
#

Can you tell me how to do it with js ?

#

I wanted it lil quick

#

if you can help ?

calm plume
#

Uh, I haven't done that myself in a while so I forget

#

But you wont get answers "quick" whenever you want

#

You need to learn the basics

neat goblet
#

ahh thanks man

#

How can I change size of a background image in css?

royal oracle
#

hi

#

can anyone teach me the basics of html?

calm plume
royal oracle
#

ok, thank you 🙂

neat goblet
#

anyone good with js here?

late gale
solemn glacier
#

go to a help channel

late gale
#

thats django related

neat goblet
#

<input type="#" value="Continue to checkout" class="btn" onclick = "alert('Your order has been placed');">

#

I have this button

indigo quail
#

heyyyy

neat goblet
#

but I want to only show order placed message when fields are filled

#

can someone tell me how can I do that ?

indigo quail
#

anyone knows how to run python script on linux vps 24/7 (flask project)

neat goblet
#

Hoow can I add a full size image in background ?

#

in css?

#

I know background image would add one. ?

#

but How can I resize for the background ?

calm plume
#

background-size: cover; iirc

neat goblet
#

thanks

#

How to fade it a little?

#

I mean adjust opacity ?

calm plume
#

There's no way to do that directly in css

#

However there are some hacky solutions

neat goblet
#

okay thank you.

#
    <center>
    <div class="slideshow-container">
        <div class="slides fade">
            <div class="number">1/3</div>
            <img src="Images/burger.jpg" style="width:50%">
            <div class="text">Burger's</div>
        </div> 
        <div class="slides fade">
            <div class="number">2/3</div>
            <img src="Images/salad.jpg" style="width:50%">
            <div class="text">Salad's</div>
        </div> 
        <div class="slides fade">
            <div class="number">3/3</div>
            <img src="Images/mmocktail.jpg" style="width:50%">
            <div class="text">Mocktail's</div>
        </div>
    </center>

    </div>
    <div style="text-align:center">
        <span class="dot"></span>
        <span class="dot"></span>
        <span class="dot"></span>
    </div>
</section>```
#

I have this slide section

#

but after 1 slide show pictures disappear

#

any sol. for that ?

#

I have a button for nav bar how can I fix it's position vertically but no horizontally ?

opaque rivet
#

since JWT tokens ship with a secret, we can say that they are untamperable.

Say we had a service for adding balance. Instead of sending data in the POST request body (where someone can intercept the request and change the balance they give themselves), what if I generate JWT tokens with this information? It sounds like a good idea to me.

^ People tell me that JWTs are meant to be short-lived and shouldn't be persisted for long. Why is that?

cosmic swallow
#

I don't know where to ask this so here is good as any
Does anybody knows package which can translate WSLD into python code (class preferably) and has realse sooner then 10 years ago?

worn mural
worn mural
#

So you need to verify if the JWT signature is valid and then proceed.

opaque rivet
#

yeah, and am I correct in saying that JWTs are stateless (so no db information is stored) so if the JWTs are not short-lived, then we will have users authorized when they shouldn't be (e.g. if they are banned)

#

makes sense.

worn mural
#

Exactly

opaque rivet
worn mural
#

This isn't a good practice

#

your post data should be sent tru the request

#

with the JWT

#

The jwt its only used to authentification

#

If you want to display the balance of a player for example

#

You should send a request to ur backend with the JWT and the backend will return the balance

#

If the JWT is valid of course

#

In my personal app I use refresh tokens with access token

#

The access tokens are valid for 5 minutes

#

And are JWT's

#

that are issued by my authorization server

#

And they can be generated from a refresh token

#

With the user logout for example I just revoke the refreshtoken

#

and they cant generate new tokens

#

After 5 minutes

#

From refresh token

#

This is the flow

#

that I follow

opaque rivet
#

Sounds good. What library do you use for them?

I'm just trying to think of ways to prevent people from intercepting http requests & changing their payload.

surreal portal
#

I love FastAPI guys. It's so smooth and creating a JWT system didn't look too hard

drifting radish
#

hello

opaque rivet
#

I'm learning a bit of FastAPI today, hence the JWT talk 🙂

surreal portal
#

Wish i could custom the username field in OAuth forms

drifting radish
#

Is it possible to make such a popcat page?

surreal portal
drifting radish
#

clicker

surreal portal
# worn mural Why so ?

I want to use the mail as an authenticator instead of a username when I want to test on the Swagger UI

drifting radish
#

ohdady gb

surreal portal
#

But the doc said "no problem you can customize the field in your frontend"

worn mural
#

Ohh

worn mural
#

People will always be able to change the payload

#

If this is a problem for you

#

you need to change your inside architecture

#

Or validade tru ur backend

opaque rivet
#

surely I'd imagine a lot of websites are prone to just changing the payload

#

if I'm adding a balance on a website, use Burpsuite to intercept the request and change balance from 5 to 500, then pay for 5, the server might have inadequate checks

#

so yeah I guess I can just use conditionals and extra checks to prevent that

worn mural
#

A local Tinder for grad students here in São Paulo(Brazil) has a premium version that unlocks more likes

#

I saw that they didn't verify if the user was indeed a premium member

#

They did everything thru the payload request

#

With a param called "unlimited" = True

#

I intercepted and made every request sent this parameter

opaque rivet
#

haha, that's great 😂

worn mural
#

and even if I didn't pay

opaque rivet
#

did you use Burpsuite for this?

worn mural
#

Noo

#

I used ProxyCharles

#

Its pretty much the same thing

worn mural
opaque rivet
#

that's great 😂, I'll have to try the same thing haha

worn mural
#

I make tons of money

#

Because they didn't launch the premium version yet

#

and people were hungry for this feature

#

So I created a custom client that send this parameter tru the request

#

and sold for other people hahaha

opaque rivet
#

😂 You're genius

surreal portal
#

A bit OT-Python related but is there an effective way a react client can use JWTs?

worn mural
#

To make requests

#

to the user information

surreal portal
#

Is there any library that can use effectively JWTs to access protected routes?

fading mason
#

whats a good udemy/linkedin course for learning django?

opaque rivet
surreal portal
fading mason
#

oh wow

worn mural
#

this is how it works @opaque rivet hahahaa

surreal portal
#

Best way to make use of webdev when you're a total beginner is trying on Flask, learning how routes work and making HTML templates

opaque rivet
#

bloody smart guy

surreal portal
#

Then you can move on to data persistence with databases and learn how RDB works, how SQL works and how ORM works

#

Next step is APIs, microservices and REST

fading mason
#

I know how DBs work, and I know general web dev stuff. Just looking to learn Django in-depth

#

mainly cuz its huge and has a ton of features

worn mural
#

@opaque rivet and this is the JWT they use to authentification

#

As you can see

#

they don't have any expiration time

worn mural
#

I can decode the jwt

worn mural
opaque rivet
#

so you have another server returning the refresh tokens?

#

and I guess each refresh token has to be specific to each JWT? So once the refresh token expires, the JWTs are invalid and can't request new ones

opaque rivet
nimble dawn
#

Is figma good for web development

calm plume
#

It's great for setting up your designs

nimble dawn
#

Like if I take codes for some elements

#

copy and paste, not the whole website only for some elements in which I get stuck

calm plume
#

That's a good way to learn. But just make sure you understand the code you're copying

worn mural
surreal portal
#

I need to sharpen my skills for front-end design for my Github pages

worn mural
#

I don't do it

opaque rivet
surreal portal
#

Though for my portfolio I'd like to try vanilla CSS

opaque rivet
#

a good component library is antd. But even better, it's tailwindUI, based off tailwindcss which is just a glorified bootstrap with some extras.

surreal portal
#

Not me. I only know flexbox and there's too much relative units to use from lmao

native tide
#

hello there

#

I think this is the right place to ask the question

#

Should someone coming from full stack js (react-js, react-native, nodejs) use flask for backend and continue to use react-js and react-native as "front-ends" or would one learn django?

calm plume
#

Go ahead and ask your question, and someone will help if they can

native tide
#

I am not sure about what should I do since js is a must for someone front end stuff but yet django features seem promising

#

correct me if I am wrong

#

:)))

opaque rivet
native tide
#

Oh, I mean i am really confident in my js kek

#

So I could easly integrate django with react-js for example?

opaque rivet
#

If you're really confident with JS then you can also go for the node.js backends, such as express

native tide
#

I mean I did use that for years, I am looking to switch for some personal reasons

#

and not to be toxic but from what I've seen django is better then flask for making scalable backends right(flask seems really good for prototyping)?

opaque rivet
#

Scalability really just depends on how you build your app. The main difference is that Django is batteries-included so it has lots of features out of the box (such as an ORM, etc.) while with Flask you can choose your modules and really personalize your app. Django is more popular.

#

and with Django it's much more easier to get going due to the amount of things already provided by Django.

opaque rivet
native tide
#

So for the projects I am working on I am doing a huge amount of stuff in C,C++, lua, nodejs,x86, so i kinda decided to move to a new more general programming language

#

since speed isn't really an issue

#

anyways thx I'll look into django :))

calm plume
#

Depends on what it is

#

But usually, no

#

Then 4ms shouldn't really matter

thorn idol
#

Can I ask a css question here? :)

#

Nvm just saw the channel info xD

calm plume
#

Ask away

thorn idol
#

So I basically tried to make a navbar with bootstrap:)

#

But the drop down isn't working..

lavish prismBOT
#

Hey @thorn idol!

Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:

• If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)

• If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:

https://paste.pythondiscord.com

thorn idol
#

Ah :/

#
<nav class="navbar navbar-expand-lg navbar-light bg-light">
      <div class="container-fluid">
        <a class="navbar-brand" href="#">Navbar</a>
        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
          <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarSupportedContent">
          <ul class="navbar-nav me-auto mb-2 mb-lg-0">
            <li class="nav-item">
              <a class="nav-link active" aria-current="page" href="#">Home</a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="#">Link</a>
            </li>
            <li class="nav-item dropdown">
              <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
                Dropdown
              </a>
              <ul class="dropdown-menu" aria-labelledby="navbarDropdown">
                <li><a class="dropdown-item" href="#">Action</a></li>
                <li><a class="dropdown-item" href="#">Another action</a></li>
                <li><hr class="dropdown-divider"></li>
                <li><a class="dropdown-item" href="#">Something else here</a></li>
              </ul>
            </li>
            <li class="nav-item">
              <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a>
            </li>
          </ul>
          <form class="d-flex">
            <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
            <button class="btn btn-outline-success" type="submit">Search</button>
          </form>
        </div>
      </div>
    </nav>
#

So yesh I kinda copied same thing from bootstrap demo to see where I'm wrong..

#

And it's still not working

late stone
#

hey yo; any motherfucker familiar with tweepy

thorn idol
#

Ah welp no one :/

opaque rivet
thorn idol
#

I'm reffering them to links

#

Do I have to download bootstrap?

#

@opaque rivet

calm plume
#

How'd you import Bootstrap?

#

Did you do it through the cdn, npm, or some other way?

thorn idol
#

Uh

#
<!doctype html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">

    <title>Hello, world!</title>
  </head>
  <body>
    <h1>Hello, world!</h1>

    <!-- Optional JavaScript -->
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
  </body>
</html>
#

Kinda like this

#

I'm new to bootstrap :/

nimble epoch
#

@thorn idol i used to have issues with bootstrap dropdowns too but it doesnt work idk why. instead try this <ul class="nav nav-pills"> <li class="nav-item"> <a class="nav-link active" href="#">Active</a> </li> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#">Dropdown</a> <div class="dropdown-menu"> <a class="dropdown-item" href="#">Link 1</a> <a class="dropdown-item" href="#">Link 2</a> <a class="dropdown-item" href="#">Link 3</a> </div> </li> <li class="nav-item"> <a class="nav-link" href="#">Link</a> </li> <li class="nav-item"> <a class="nav-link disabled" href="#">Disabled</a> </li> </ul>

topaz widget
#

Hey does anyone know why Chrome would botch a CSS transition on the first attempt but get it right every time thereafter?

hoary brook
topaz widget
hoary brook
#

Ah okay, I was just wondering since it's happened to me before as well

topaz widget
#

I tried just running the transition before the user would get to it, but it seems to have to be visible on the page.

hoary brook
#

Yeah, transitions and animations get initiated when the element becomes visible.

topaz widget
#

I gotta tell you, I'm getting pretty sick of the browsers' rendering engines. I'm probably just gonna switch entirely to WebGL for visually intensive stuff from now on.

sudden sonnet
surreal portal
#

Isn’t NodeJS too heavy for backend?

#

Ppl usually recommend Rust and Go for backend hough any language can do the trick

opaque rivet
#

It's one of the fastest too (i don't know why though)

#

same goes for Go

nimble epoch
#

what you mean? you mean like request.GET['arg']

sudden sonnet
#

Anyone help me with flask please

#

ping me if your available

calm plume
#

Just ask your question, someone will help if they know.

late stone
#

ho

#

hi @mellow stone. ill help you if you buy me resident evil village

sudden sonnet
#

and shows a 404 error

native tide
burnt night
#
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: fe_sendauth: no password supplied```

How would I supply a password?
Django: Using the `django-crash-starter` cookiecutter
opaque rivet
#

firstly check if the service is running

burnt night
#

The postgreSQL service is running

opaque rivet
# burnt night Yes please

and you're using the cli command:
createdb <what you have entered as the project_slug at setup stage> -U postgres --password <password>?

burnt night
#

no please

#

the cli command being used is:

python ./manage.py migrate
opaque rivet
# burnt night no please

have you done:

$ export DATABASE_URL=postgres://postgres:<password>@127.0.0.1:5432/<DB name given to createdb>
# Optional: set broker URL if using Celery
$ export CELERY_BROKER_URL=redis://localhost:6379/0
burnt night
#

Oh my gosh I got it 😭

opaque rivet
#

what was the issue?

burnt night
#
# https://docs.djangoproject.com/en/dev/ref/settings/#databases
DATABASES = {
    # Raises ImproperlyConfigured Exception
    # if DATABASE_URL Not in os.environ and
    # the "default" argument is not defined.
    # The DATABASE_URL environment variables
    # expect a value in the following format:
    # DATABASE_URL=postgres://user:password@hostname_or_ip:port/database_name
    "default": env.db(
        "DATABASE_URL",
        default="postgres:///everycheese",
        
    )
}
DATABASES["default"]["ATOMIC_REQUESTS"] = True
#

That was all that was provided

#

then I added in these two lines

DATABASES["default"]["PASSWORD"] = 'pword'
DATABASES["default"]["USER"] = "postgres"

😭

#

And it finally worked

#

oh my gosh...

#

just took 20 hours '-'

#

My first time working with this...
so I didn't know 😅

timid olive
#

i need help with a html/css problem, if you would like to help please go to #help-popcorn

surreal portal
#

Anybody ever used orator-orm ?

opaque rivet
#

sqlite locks up when you read/write correct? so you can't have concurrent queries?

astral pagoda
#

I had a file called flaskblog that I divided into folder called flaskblog. The code was working while in the file flaskblog. There are a few other errors but I would like to start with this one .

my file tree looks like below.
| | _ _ flaskblog
| | | _ _ users
| | |_ _ routes.py
| | | _ _ models.py
| | | _ _ forms.py
| | |_ _ --templates
| | _ _ __init __.py

Here are some of my imports
from flask_wtf import FlaskForm
from wtforms import TextField, BooleanField, PasswordField, StringField
from wtforms.validators import DataRequired, Length

Anything to do with imports of wtf is not working. It is highlighted similar to spelling mistakes in word. I already have it installed using pip install any advice ? I even tried to install it again.

wooden path
#

Hi, I'm uploading a flask API to GCP at the moment, but I have never used any cloud platform before. At the moment, I have most of the application in the editor including a yaml, requirements, a venv, and all code. There are also files from a user that will be stored here. Is this the best place to store these files, or is there a better option I should be looking to after this is deployed?

outer apex
wooden path
#

I generate the files, store it somewhere, and then it gets sent back to the user if requested

#

They're mainly text and audio files

outer apex
#

Gotcha. Maybe consider Cloud Storage? The API to handle files in Storage is probably pretty straightforward.

wooden path
#

ahh I will give that a try

#

Thanks!

#

If I had a pytorch model that's being deployed with the app, is it best not to move that?

outer apex
#

I'm not familiar with pytorch models. Are they relatively stable and not for distribution? If so, it's probably okay to keep it with the app.

wooden path
#

I'm honestly not too sure, I was mainly given this code and told to host it. The model is only being used by the app itself so I guess that means i'll just leave it as is

outer apex
#

Gotcha. Yeah, that's probably fine.

wooden path
#

Thanks for your help!

last orchid
#

When I start a jupyter-notebook server for instance, it gives me a token i need to use to connect to the frontend with:

#

How would I go about implementing something like this in an app I'm making? It runs similar to jupyter with a local server and a web frontend
I'm using Flask. I know I can basically use flask_login to do it, but bringing that in seems a bit overkill for the situation, where I just want to randomly generate a token
I'm thinking about essentially just writing my own "middleware" and comparing against a randomly generated number at startup, but I feel like there's probably some gotchas there
and I'm imagining there are packages that let me do this sort of thing cleanly and explicitly.

stable hemlock
#

Anyone here have a guide for converting an existing django project to async?

gusty igloo
neat goblet
#

I have slide show in my website made using html and js but after slide show is finished once it's not showing images again. Can someone help me with that please ?

heady ore
#

How to find the problem if no error showed while using message_queue?
I'm working with flask-socketio and start the socketio with:
socketio = SocketIO(app, cors_allowed_origins = '*', async_mode = "gevent", message_queue = config.REDIS_CONNECTION_STRING_6380)
The server does't show any error message, but shows "Cannot receive from redis... retrying in 1 secs" sometimes.
Can anyone tell me how to fix it?
I'm using Azure Redis Cache as a message queue database.

#

BTW, I've confirm the Redis can be use with:
r = redis.Redis.from_url(config.REDIS_CONNECTION_STRING_6360)
r.set("foo", "barb")

sudden sonnet
#

Anyone know where I can host a website with flask?

fading bluff
#

Wait

#

Can you use react native with Python?

proper mural
#

hi guys :D
i had a question !
how can i generate my wanted picture url for my html code ?

cunning tendon
proper mural
#

i write this code but idk how to generate my wanted photo url

#
<img src="img url wanted">
proper mural
#

i know how to set a picture using the name of it in the folder of my project but i dont know how to have the pucture url

hallow yacht
#

django and python issue... posted on stackoverflow. if someone would give me a small insight or maybe solve this . Been breaking my head on it for the last couple of hours / days 😦

proper mural
#

i want something like this

<img src="https://cdn.statically.io/img/i.pinimg.com/originals/3b/8a/d2/3b8ad2c7b1be2caf24321c852103598a.jpg">
solar valve
#

guys how do i scrool to end of the div using selenium each time div updates when you reach at the end of the div

hoary brook
#

I'm guessing you're getting warnings at these classes?

twilit needle
#

how would u use cassandra with django?

nimble dawn
nimble epoch
proper mural
nimble epoch
proper mural
#
<img 
src="https://cdn.statically.io/img/i.pinimg.com/originals/3b/8a/d2/3b8ad2c7b1be2caf24321c852103598a.jpga">
nimble epoch
proper mural
#

idk is it too hard too undrestand ? idk how to say it to be undrestanable

nimble epoch
#

you want to get your image url based on this https://cdn.statically.io/img/:domain/:image so you need to see how to use this statically app or anything else it is

lavish prismBOT
#

Hey @woeful basalt!

Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:

• If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)

• If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:

https://paste.pythondiscord.com

cold estuary
#

can i ask question reg flask here

woeful basalt
#

never mind it worked hahaha

#

thanks guys anyways (wanted to ask a question and it worked )

inland oak
cold estuary
#

i am trying to build a simple weather app uisngg python flask that just shows temp

#

this is my appp.py i just want to show current and hourly temp in my front end how can i do that

twilit needle
night sequoia
#

anyone know django?

calm plume
night sequoia
#

how i can authenticate user with using email?

#

instead of username

#

in django

urban bramble
#

Hello Everyone

urban bramble
#

channel discord community django ??

nimble dawn
calm plume
cold estuary
nimble dawn
#

Nice

surreal portal
#

FastAPI users, when you need to access a protected route, the payload must have a token attribute, doesn't it?

buoyant shuttle
#

Any Javascript library for graphing

dull pier
#

there are plenty enough to get confused

dull pier
buoyant shuttle
buoyant shuttle
#

Ty

#

Do I use raw js or react

calm plume
#

There is a react wrapper for it

#

But you can use chartjs fine probably

buoyant shuttle
#

Ty

calm grove
#

how would I run a python script using html?

grave needle
#

What do you guys use for web development?

calm plume
#

Front or backend?

grave needle
#

I use Django

#

Any

#

I'm generalising

calm plume
#

I usually use React with Sass or TailwindCSS for frontend, and Node.js, Django, or FastAPI for backend.

grave needle
#

Cool!

grave needle
elder root
#

sorry wrong channel

buoyant shuttle
#

just django and react

calm plume
grave needle
calm grove
calm plume
#

Ok

solemn glacier
calm grove
#

hehe

#

python puns

solemn glacier
#

I think the guy you replied to was talking to somebody else.

#

What do you mean

#

Run a python script with html

calm grove
#

i mean

calm plume
calm grove
#

like how?

solemn glacier
#

You must first describe your intention

#

what is your goal

calm plume
#

You could use HTML as part of the frontend and Python for the backend

solemn glacier
#

what are you trying to do

#

excuse the typos, my keyboard is too slow for my fingers

calm grove
solemn glacier
#

No, it's not.

calm plume
#

Check out Flask or Django. It's make more sense then. But basically, you could use HTML as part of the frontend and Python for the backend

solemn glacier
#

in general terms

rare ibex
#

Hey, can someone help me with making my flask webhook listener work

solemn glacier
#

you can't run client side python code in a web browser by visiting a page

rare ibex
#

so i made this to listen to post requests from a platform, but it doesnt work with my local machine ip url

calm grove
rare ibex
#

but i hosted the same code on replit and gave that url, it worked there

#

so how do i make my webserver public so that theplatform can send requests there

solemn glacier
#

They're back end python frameworks for web servers. I think you should first review the concept of frontend/backend or rather client/server

solemn glacier
#

a public facing web server?

rare ibex
calm plume
rare ibex
#

but rn, its just for testing

#

but i cant test if it doesnt work on my machine

solemn glacier
#

or you an only connect to the platform api when its hosted

#

not on your local?

solemn glacier
#

what i mean is the problem you are facing is it that you can test when you host on your vps, but not on your local machine?

rare ibex
solemn glacier
#

you can't do the post requests?

rare ibex
#

i will but not now

solemn glacier
#

Sorry I still don't have a clear undertanding of the exact problem

rare ibex
#

there's this platform called repl.it that runs python code online, so i ran my code there and gave that url

solemn glacier
#

ok

rare ibex
#

but when i local host, i get address like http://121.0.1... and when i give that, it doesnt work with it(the platform that sends webhooks doesnt work with that url)

solemn glacier
#

oh

#

the platform isnt local

#

the second platform

#

making the requests

#

?

rare ibex
#

nope

solemn glacier
#

You'll need to portforward

#

i dont suggest it though

rare ibex
#

its another api/website that sends pings when user purchases a product and stuff like that

rare ibex
solemn glacier
#

I wouldn't expose your local web server to the public net

#

er

#

hmm

solemn glacier
#

can you move your platform making the requests to local

#

for testing

rare ibex
rare ibex
solemn glacier
#

127.0.0.1 is an ip address for a local connection, without NAT. so he would use that if he broadcast to his loopback address only but the problem is

calm grove
#

@calm plume basically i'm just trying to make some kind of hangman website for a little portfolio project. just something to be able to say that i did. not very important but i want to know if i should use js for it or python. python would be easier cuz i already have a python script for hangman. how would i go about using that script to make hangman website? or is it to complicated and i should just use js

rare ibex
solemn glacier
#

A third party service on the internet can not make a request to his loopback obviously, or even his local machine unless he exposes it to the internet via portforwarding

rare ibex
#

how do i expose it to the internet?

solemn glacier
#

portforward on your router

#

are you in a basic nat environment?

rare ibex
#

uhh idk what that means lol

solemn glacier
#

it's not a good idea

rare ibex
#

hmm

solemn glacier
#

Do you need the post data from the third party platform

rare ibex
#

so the only other option is hosting it on my vps?

solemn glacier
#

or can you do it yourself

#

and send it locally

#

The VPS should work

solemn glacier
#

vps*

rare ibex
#

hmm i dont rlly have access to the vps right now, so ig ill just run it on repl.it to check ifmy code works, is there any other option?

solemn glacier
#

don't use NAT

#

which is 100x worse than portforwarding lol

rare ibex
#

also when i host on my vps in future, i just have to give the url that it outputs when i run the flask code right?

solemn glacier
#

you'll want to make sure you bind to the correct address

#

by the way

#

those post requests

#

your local machine is a web server listening for post requets? it is not sending any type of request to initiate it?

rare ibex
#

oh it does work with an wrapper for google sheets

solemn glacier
#

ya, vps is your best option or generating the requests locally

leaden carbon
#

hey has anybody used dash from plotly here?

calm grove
#

i just changed my username. why

#

because i can

rare ibex
#

like it executes a task(update googles sheets) when it receives the post request from platform

barren knoll
#

I need Help with a SAAS Project , its urgent , I need a guy who has experience with Flask , REST API and has experience with hosting in digital ocean and stuff !

azure saddle
#

is it hard to deploy a flask project? i've been thinking about learning flask more

wooden ruin
#

if you are using static files you will need to configure this with something like nginx or whitenoise

azure saddle
#

oh, thanks for the info!

surreal portal
#

Corey Schafer has a vid abt hosting a Flask app with Linode

#

I think it's pretty much the same

rare ibex
#

@leaden carbon cant i use flask-ngrok?

#

to make it public

barren knoll
#

I need a guy as a backend dev for a SAAS Project , its urgent , experienced with Flask , REST API , Scraping with Selenium and has experience with hosting in digital ocean and stuff ! If you are ready shoot me a DM

native tide
#

lets say I have a python set how can I show all the items in a python set to a html list?

wooden ruin
#

however it's best to use a templating engine like the one flask/django use

opaque rivet
#

can you guys explain why you can't have websockets with WSGI? Why can't you just handle the request on a thread?

buoyant shuttle
#

Hye guys I'm having problem

#

My graph is not showing in chart. Js

regal raven
#

Heyo. I'm building 2 web apps in Flask and have the same problem in each on multiple environments, which tells me the problem is with me not understanding something.

#

I am trying to use Flask's redirect function. The line looks like return redirect(url_for("play"))

#

But instead of sending me to the proper location, it redirects me to http://localhost/play

#

Why is this? Is there some server configuration I need to do? Am I supposed to supply flask run some additional flags?

native tide
#

Or quarts?

regal raven
#

From what I'm reading online, it seems I need a web server like Apache or nginx or something atop my Flask app. Hopefully that will fix things?

wooden ruin
wooden ruin
regal raven
#

Well, I don't see why this shouldn't be possible with the default webserver

#

in flask

#

(also i'm not just serving static files btw, i rely pretty heavily on jinja2)

wooden ruin
#

no need to worry about jinja2, that's handled with a wsgi/asgi server

regal raven
#

well, any idea about the redirects issue?