#web-development
2 messages · Page 157 of 1
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
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.
Yes, so I connect a websocket
Yea, I can setup the backend, wanted to know how I'd connect them
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.
Okay yes, thanks!
okok my bad 😅
<@&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.
Please DM @hexed spoke with the details of your project
Can you make a forum with just purely HTML and CSS?
Probably not. You would need something like js to make it reactive and you'd need a backend too
or do you need something like JavaScript
oh
can you use java for web devlopment
instead of js
No, java is not a web development language
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.
Pretty sure dockerizing is just good because with a simple docker compose up, your program can run
Well, assuming you're using docker compose
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?
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.
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
Do i really have to use alembic to initialize a table in a database?
yes, if you wish your project being easy developed later.
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
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
use alembic or its alternative. It would be a great win for you
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
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
that's why I love Django webframework
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
By the way, for a production database, would you rather use MySQL or PostGreSQL?
Personally, I would go with PostgreSQL.
me too
PostgreSQL is open source with free license
it is more preferable to invest your skills into it
Postgres is a solid choice
If you're forced to use MySQL you should use MariaDB instead on that note as well
Last time i've used MySQL was as a Docker container for a Flask app. Maybe I should use Postgres instead
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.
Here's my signals.py file:
And here's my apps.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?
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
Can anyone help me in this?
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?
Surely
this is whole branch of Django exactly for that
Django, API, REST, Home
exactly how it is used ;b
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
They do different things, unless you're referring to DRF
DRF, link above
Ah, got it
for form.email.label you dont need parentheses and you can you class=“” in form.email() -> form.email(class=“email-input”) like this
Setting up database has been a pain when I was working on Flask
same, same
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
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
yeah
I told someone yesterday something like
Learn with Flask
Build with Django
Although with recent Flask upgrade
Flask can become more sweet
Help needed in this!
Does Flask 2.0 support ASGI?
Since FastAPI is built on Starlette I have an easier time than with Flask
at least Flask 2.0 claims
Support async views, error handlers, before and after request, and teardown functions. #3412
Might be interesting though I'm afraid all the extensions might break.
Especially Flask RESTful
yeah, same thinking
that's why I would choose FastAPI for real project
Flask 2.0 is too much new)
Yeah i'm keeping Flask 2.0 for experimentation
fastapi will generally be more performant as well
not that it matter much
but for rest apis and stuff like that fastapi is king
Yeah because right now I'm trying to use it for user authentication
would it be great for GraphQL as well?
nice
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
I mean anything can use authentication
pretty much liking roadmap of backend skills
useful to get answers like that quickly
flask mega tutorial teaches to use JWT
hmm, for now hehe I use it, until I would learn alternatives at keast ;b
JWT is nice for seassion handling
That's good to hear. because I can always use that: https://testdriven.io/blog/fastapi-jwt-auth/
nice
definitely using FastAPI as next framework ;b
when I would finish taking my time with Django though
Hey guys, hope you are all well.
I would like to decode and display a tiff image in the browser using javascript.
Non of these seems to work: https://github.com/seikichi/tiff.js and https://github.com/GPHemsley/tiff-js
any help is appreciated
it is the same way when you make a class attribute for html elements
and then you call it in css file
Also this is going to sound crazy but can you host a backend on Github pages?
No, I don't think so.
static only
Btw, what stops from deploying frontend to github pages 😉
like react ;b
it should be possible in theory
you can
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>
...
According to create-react-app you can
what's the difference between tokens and jwt?
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
jwt are json web tokens
theres other types
anyone could make their own token type and use it
but jwt are what we all use
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
I heard JWTs are just meant for short-lived requests and something more persistent like token cookies are preferred for authentication
yeah, you can encode time of expiration into generated token by JWT
you can put the jwt into the cookie
a time of expiration which will prevent decoding it back ;b, once time is out
smart, so jwt's are just normal tokens but JSON, so they can have different parameters
if someone says tokens, they 99.99% of the time mean json web tokens
theres literally no other 'token' that people talk about
at least they are JSON when they are decoded.
when encoded they look like one string of mess as usual
https://pyjwt.readthedocs.io/en/latest/
I used more raw version
interesting though to try a hand in your found choice
This might be of interest to you!
https://phiresky.github.io/blog/2021/hosting-sqlite-databases-on-github-pages/
I was writing a tiny website to display statistics of how much sponsored content a Youtube creator has over time when I noticed that I often write a small tool as a website that queries some data from a database and then displays it in a graph, a table, or similar. But if you want to use a
Thank you! I was wondering if it would be nice to have a personal webpage here that did some stats
Yes, AJAX and the Fetch API are your friends.
https://stackoverflow.com/a/45370541
i'll give it a go thanks for the feedback @outer apex , pretty new stuff for me so hitting a few walls
That's fair! This Discord group ain't going anywhere so definitely ask on here if you have more questions! 🙂
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?
Hello, I'm new here.. Does anyone know about FLask?
What do you want to know?
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
install and import it
I dont understand where I'm doing it wrong
with pip3?
using python3?
Are you using a venv?
Did you actuvate and install deps in it?
show us some screenshots
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
ok wait
pip3 list
That is not the output from the env
that ist actually your normal python. You shoul activate the env first
okay let me install this one
Are you using pycharm?
Are you using pycharm my guy
yeah i am
Use pycharm's integrated terminal
do it the easy way in the settings
no he dont
Should I create the env. then install flask. then write the code?
in a single folder?
I'm a she 😛
im sorry
You make the venv
You activate it
You install your deps
You run the program
should we help you in a screen share with voice chat?
yes please
Voice Chat 1
okay
yeah why?
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
Let me try that
If pycharm already made a venv for you skip to step 2
If you can't see that channel, it won't link
All righty, lets go sneaky
erase space in <# 764802555427029012> to form the link ;b
They wont be able to verify, they only have 40 messages here
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
I'd suggest you first add a space after the single quotes
From the code it seems that the URL isn't resolving properly on the front-end. Have you namespaced the URLs?
Can someone help me with that?
path('post/<new>/', PostCreateView.as_view(), name='post-create'),
here is the url on the views.py
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?
looks like magic of Pathlib https://docs.python.org/3/library/pathlib.html?highlight=path#module-pathlib
hello mind if i ask what's better for web for data science matplotlib or chartsJs
Oh, I see
Thank you
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?
How do I have a custom url for flask?
Looking for someone to help me with web design. Take around 1 till 2 hours priv.
FastAPI is pretty lightweight I don't get how Django is not an overkill but FastAPI is
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
Maybe use Starlette (what fastAPI is built upon?)
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 🙂
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
Anyone who knows how to use Codepen.io ?
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..
Thanks for Starlette. That's a good pivot. I've been reading the docs for the past 30 minutes and going to read some more, too.
sure thing. also, I think an API would be the best option. I may be wrong here but you could probably dockerise your linux service and run it on windows (iirc linux docker images work on windows as windows has a linux kernel - something like that) and they'd be able to communicate via http. But an API would probably be the easiest option, and starlette looks lightweight
"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!
It’s exclusively HTML - CSS - JS though
I have an issue tho
Soo like my picture is next to my text with the link on
How do I get my picture above --
If you're directly talking between two machines and do not want to possibly setup a server (depending on how you'd like to structure the program) you can also look at sockets.
Is there a particular Python amazing magical package which makes sockets painless and all that jazz?
that comes to mind?
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.
Here it is with a drawing...https://unix.stackexchange.com/q/647069/9494
Already looking at it 😛
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)
Either of those options are fine there is no right or wrong answer. It's whatever you're comfortable and okay with.
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
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.
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.
This is a very basic article: https://shakeelosmani.wordpress.com/2015/04/13/python-3-socket-programming-example/
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?
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
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.
Meaning you're running them as a subprocess that is detached? It shouldn't be blocking the event loop.
If you're calling a function that will open up a socket/connection you don't want to do that directly with Django where it sits and waits for the connection to close.
It's blocking the view function
Yeah, don't want to do that then.
don't cross the streams, huh?
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.
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
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.
you can get websockets working with django using django channels, but's there's a bit of overhead moving from the default wsgi server to the asgi server - it looks much easier in starlette or fastAPI
Don't touch Django channels. Don't over complicate this. That would really screw with his current django instance w/ middleware and all
Django is just the front end replacement for CLI
could you elaborate?
It supports the scripts, which are really just ported over, and right now what they return is ..
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.
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.
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.
That's fine. You can create an endpoint that fetches the current status of the celery task. Use JS to keep sending a request every X amount of seconds.
Once the task is completed then you can return the response from the task. You can also use Django models with Celery.
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
It's not too bad
you can use fetch or axios
If you're wanting cron jobs too then celery would work perfectly.
ah yeah, there's performance hits when mixing async and sync, when switching to an ASGI server the middleware (that ships with Django) is still sync, right?
That majority of it, yeah. The ORM still isn't async either which sucks. I really need Django to be fully async 😬 There is a lot of gotchas with it atm
That likely wont be for a whileeeeeee
Django is so massive it's incredibly hard to rewrite
I know 🥲
The amount of work it took to get Channels working was more than what most applications even come close to in terms of design
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)
so im building a website and i wanna transfer info from my back end to my front end. anyone knows what i can do?
Correct. There could still be problems with Celery (I haven't done it before). It should be fine, but I cannot guarantee it.
Not sure I understand the issue with MongoDB?
You should learn a Python web development framework which will include a system for templating your HTML
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
No issue. It's meant as an analogy. My project uses Mongo, but I don't integrate it into Django. Same as @opaque rivet was mentioning websockets:
you can get websockets working with django using django channels, but's there's a bit of overhead moving from the default wsgi server to the asgi server
would i have to use React or something of that sort?
I was just making sure I can use sockets without integrating with Django or having to deal with that
No, you don't need to.
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?
oh
Because it would have to switch between async to sync and then most likely back again.
It really depends on what you're doing in your application.
can you link me to a tutorial or a guide in which i can follow along or learn from?
so switching from sync -> async (vise verca), how does that occur do you know?
I don't know it all off the top of my head tbh. But the docs for it explain it quite well: https://docs.djangoproject.com/en/3.2/topics/async/
I like Miguel Greenberg's Flask tuts https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world
oh ty
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
What's your goal? To get hired or?
i think fastapi is my next venture
You can have it! haha I'm using Sockets or Starlette
I highly recommend Corey Schafer: https://www.youtube.com/watch?v=MwZwr5Tvyxo&list=PL-osiE80TeTs4UjLw5MM6OjgkjFeUxCYH
thank you guys so much
yes, in the long run
so I guess django would be the best option generally, but I'm only using it as an API and that's about it
Learn Django then tbh. Django as an API with DRF (django rest framework) is phenomenal
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
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
Should be fine with it as long as you're using a task queue and Celery
There is a lot of jobs with Django as well. JS you can always learn to compliment with Python.
Learn a frontend framework (highly recommend React, even though Vue is easier for a beginner).
yes true, I already compliment it a good chunk with react. I decided to stick with python backends for data science / ML interests
You will always need a way to present that data.
That discussion was started when I came onto Discord this afternoon: #web-development message
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
It should. Once you get to a certain point you might want to spend time learning more web technologies
It's how I started
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
No worries! Best of luck hope you get it figured out.
hello
hi
wasup
Someone can help with django? I'm a beginner in django
I need to consume api for a homework
just post your question
don't ask to ask
I favour Angular myself
React is very popular though
Okay, I did know about this
You should take a look at this message: #web-development message
How do I center my text, Its in the center. But I want it in the middle
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?
Like horizontal or vertical centering?
what is the directory structure of your app? are the templates in the templates directory? are you passing a custom templates path when instantiating your Flask app? Are you sure you named your file correctly - all the capitalisation etc.?
This is my dictionary view
the backend file is the file for writing the flask code]
what's in the templates directory? can you share how you're instantiating the Flask instance?
It's working now. But it wasn't working for the entire night and when I used redirect and idk why
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.
I was just trying out different solutions
👍
But I didn't know that so I'll keep that in mind. Much appreciated
How do I use a a not equal in django filter?
127.0.0.1?name__ne=chris
any soln to this django not recognized in venv
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?
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 ?
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
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 ....
if you use bootstrap you can add class fixed-bottom and h-100 then add background-image using css
i use css right now and i right this code bellow but it doesent works
<!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>
ok let me try it
ok :)
you want it to be the background of whole page or just paragraph?
oh ok
im just trying it but i cant do it
i want to set it as the whole bg
it works body {background-image: url("https://cdn.statically.io/img/i.pinimg.com/originals/3b/8a/d2/3b8ad2c7b1be2caf24321c852103598a.jpg"); background-size: cover;}
aha ok thanks alot :DD
yw🙂
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
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
no problem
Can you help me with JS as well ? @hollow mulch
yes, what is it?
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
How can I make my website compatible for mobile phone view?
make it responsible
here has enough info https://www.w3schools.com/html/html_responsive.asp
I've these buttons
with prize
what should I do that if I click any of them I am redirected to a payment page
can anyone help with this using chromedriver
anyone please help me ?
Yes
I've fully functional website, can anyone tell me how to add payment gateway in it ? using js?
maybe send me the scipt?
It's… not that easy.
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.
stripe doesn't work in all countries, sadly
(if it doesn't, you can probably find an alternative)
Can anyone show me example of functions on daily life projects?
What do you mean by daily life?
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 :/
helo can somone help me out i have a rly simple question about html css
who can help me ?
Ask away
how do i put read me under back to login?
Like apps we use or websites we visit
What do you mean by "functions"?
Horizontally center?
text-align: center; should do it
yes
Assuming the parent class spans across the whole square
can i write that in html or do i need to do that in css?
css
oke i will try
Python functions
Like Django, FastAPI or Flask? If so, I'm not sure. But https://git.pydis.com/site uses Django
it did not work
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?
There is, but it's very old and bad practice
Can you show the html code for the "Back to login" button too?
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
is this a appropriate channel to ask about selenium?
<div class="signup_link">
<a href="login.html"> Back to login</a>
</div>
Ok, what's the css for both?
anyone ?
they dont have css
can someone please help me here
i want to get the qrcode that has the ticket email and checks if it equals to email
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
What framework are you using?
Are you using a Python framework?
You could probably do that with css
Or some basic js
Here's a good course on that: https://www.coursera.org/learn/html-css-javascript-for-web-developers
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
I doubt anyone here personally can do it, but this is a great course on it: https://www.coursera.org/learn/html-css-javascript-for-web-developers
ok, thank you 🙂
anyone good with js here?
can someone help me here please
go to a help channel
thats django related
<input type="#" value="Continue to checkout" class="btn" onclick = "alert('Your order has been placed');">
I have this button
heyyyy
but I want to only show order placed message when fields are filled
can someone tell me how can I do that ?
anyone knows how to run python script on linux vps 24/7 (flask project)
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 ?
background-size: cover; iirc
There's no way to do that directly in css
However there are some hacky solutions
Here's some info on that: https://css-tricks.com/snippets/css/transparent-background-images/
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 ?
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?
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?
Because you cant invalidate a JWT. Let's supose someone hacked your account and had access to your JWT and this JWT had a 1 week life time, even if you changed your password they would be able to perform actions using your account thru this token. It isn't safe.
You could generate a token with this information, but that is the beauty of JWT, they are signed, so unless they had access to your private key they wound be able to forge a valid signature.
So you need to verify if the JWT signature is valid and then proceed.
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.
Exactly
hmm yeah. I don't think I'll be able to JWT encode my POST data, because then I'll have to make a seperate request to my server to return the secret key, and that can be intercepted.
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
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.
I love FastAPI guys. It's so smooth and creating a JWT system didn't look too hard
I love FastAPI too
hello
I'm learning a bit of FastAPI today, hence the JWT talk 🙂
Wish i could custom the username field in OAuth forms
Is it possible to make such a popcat page?
Haha same here. Especially for authentication
Why so ?
clicker
I want to use the mail as an authenticator instead of a username when I want to test on the Swagger UI
ohdady gb
But the doc said "no problem you can customize the field in your frontend"
Ohh
JWT
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
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
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
haha, that's great 😂
and even if I didn't pay
did you use Burpsuite for this?
I was able to do unlimited likes
that's great 😂, I'll have to try the same thing haha
hahahaha
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
😂 You're genius
A bit OT-Python related but is there an effective way a react client can use JWTs?
Sure
To make requests
to the user information
Is there any library that can use effectively JWTs to access protected routes?
whats a good udemy/linkedin course for learning django?
You could most likely make a middleware for this
Ohh Idk of any library
CS50: Web Dev on EdX
oh wow
this is how it works @opaque rivet hahahaa
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
😂 😂
bloody smart guy
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
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
@opaque rivet and this is the JWT they use to authentification
As you can see
they don't have any expiration time
is this graphQL?
So if I ever had access to the admin access token I would have unlimited access
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
also, what do you think about encrypting the JWT tokens themselves? That way outsiders can't see its contents?
Is figma good for web development
It's great for setting up your designs
Like if I take codes for some elements
copy and paste, not the whole website only for some elements in which I get stuck

That's a good way to learn. But just make sure you understand the code you're copying
Good Idea but not really needed
I need to sharpen my skills for front-end design for my Github pages
I don't do it
check out tailwindUI, do you use react/vue?
React and I've already heard of material-ui
Though for my portfolio I'd like to try vanilla CSS
a good component library is antd. But even better, it's tailwindUI, based off tailwindcss which is just a glorified bootstrap with some extras.
Baidu uses it I've seen
Not me. I only know flexbox and there's too much relative units to use from lmao
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?
Go ahead and ask your question, and someone will help if they can
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
:)))
django isn't a frontend framework, so for front-end, you will have to end up learning JS
Oh, I mean i am really confident in my js kek
So I could easly integrate django with react-js for example?
Yes
If you're really confident with JS then you can also go for the node.js backends, such as express
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)?
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.
how come you wanted to move from node.js? I was thinking to move to it before deciding for FastAPI
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 :))
Ask away
So I basically tried to make a navbar with bootstrap:)
But the drop down isn't working..
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:
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
hey yo; any motherfucker familiar with tweepy
Ah welp no one :/
did you install all bootstrap dependencies including js
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 :/
@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>
Hey does anyone know why Chrome would botch a CSS transition on the first attempt but get it right every time thereafter?
Maybe you have defined the transition in something like the :hover element instead of the "main" element.
Thanks for the response, but the transition is initiated by JavaScript after clicking on an element.
Ah okay, I was just wondering since it's happened to me before as well
I tried just running the transition before the user would get to it, but it seems to have to be visible on the page.
Yeah, transitions and animations get initiated when the element becomes visible.
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.
anyone able to help me in #help-cheese
Isn’t NodeJS too heavy for backend?
Ppl usually recommend Rust and Go for backend hough any language can do the trick
Node.js backends are really minimal, comparable to Flask
It's one of the fastest too (i don't know why though)
same goes for Go
what you mean? you mean like request.GET['arg']
Just ask your question, someone will help if they know.
When i host my website locally it works but when i uplaod the files to my hosting provider it doesn't work
and shows a 404 error
I will buy you (" I'm only joking")
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
this for postgreSQL?
firstly check if the service is running
and you're using the cli command:
createdb <what you have entered as the project_slug at setup stage> -U postgres --password <password>?
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
Oh my gosh I got it 😭
what was the issue?
# 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 😅
i need help with a html/css problem, if you would like to help please go to #help-popcorn
Anybody ever used orator-orm ?
sqlite locks up when you read/write correct? so you can't have concurrent queries?
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.
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?
What's the file being used for? Is it mainly for reading, or are data getting written into it? Is it ever going to be distributed/sent?
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
Gotcha. Maybe consider Cloud Storage? The API to handle files in Storage is probably pretty straightforward.
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?
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.
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
Gotcha. Yeah, that's probably fine.
Thanks for your help!
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.
Anyone here have a guide for converting an existing django project to async?
Are you running it on virtual environment?
Yeah that works! Thanks man!
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 ?
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")
Anyone know where I can host a website with flask?
hi guys :D
i had a question !
how can i generate my wanted picture url for my html code ?
Probably going to need some more info!
i write this code but idk how to generate my wanted photo url
<img src="img url wanted">
something like this but i dont have the url and i dont know how to generate it
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
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 😦
i want something like this
<img src="https://cdn.statically.io/img/i.pinimg.com/originals/3b/8a/d2/3b8ad2c7b1be2caf24321c852103598a.jpg">
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
Are you following the tutorial series by Corey Schafer? The same thing happened for me, if I remember correctly it thinks the class doesn't exist in flask_wtf, but you can ignore the warning, it works either way.
I'm guessing you're getting warnings at these classes?
how would u use cassandra with django?
I understand but I am not good at positions I just copy the the width and height codes
when you using django you can add something like py {% static 'path/to/image.png' %} but if you are not using django or any other frameworks that work like that copy your image in the same directory where your html file is and do it like ```html
<img src="./image.png" />
no no i know that i dont have problem like this im saying idk how to generate the picture url
for exampel the picture url is like this : https://cool-picture.com
oh you mean somehing like uploading image to dropbox or ... and using its url?
yeah something like this code 👇🏻👇🏻👇🏻
<img
src="https://cdn.statically.io/img/i.pinimg.com/originals/3b/8a/d2/3b8ad2c7b1be2caf24321c852103598a.jpga">
i think you actually want to learn the app, right?
no bro i just want to have the url of my picture
idk is it too hard too undrestand ? idk how to say it to be undrestanable
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
and this is its docs about images https://statically.io/docs/using-images/
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:
can i ask question reg flask here
never mind it worked hahaha
thanks guys anyways (wanted to ask a question and it worked )
sure. That's the perfect place for this
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
anyone know django?
Just ask your question, we'll answer if we can.
Hello Everyone
you have to use custom user model - https://docs.djangoproject.com/en/3.2/topics/auth/customizing/#substituting-a-custom-user-model
channel discord community django ??
What is your app about, weather?
Can you elaborate on what you're asking?
yes
Nice
FastAPI users, when you need to access a protected route, the payload must have a token attribute, doesn't it?
Any Javascript library for graphing
there are plenty enough to get confused
do you need specific modules in that lib? license constraints? browser compatibility?
Alike a react wrapper for graphing stuff for statistics
Ty
how would I run a python script using html?
What do you guys use for web development?
Front or backend?
I usually use React with Sass or TailwindCSS for frontend, and Node.js, Django, or FastAPI for backend.
Cool!
I don't know how CSS preprocessors work yet...
sorry wrong channel
just django and react
Sass is just a different CSS syntax with some nice extras really. Its variables and nesting are really nice.
Cool!
weekend.
Ok
what lol
I think the guy you replied to was talking to somebody else.
What do you mean
Run a python script with html
i mean
HTML and Python do very different things, you don't run one using the other. However, you can use them together.
like how?
You could use HTML as part of the frontend and Python for the backend
what are you trying to do
excuse the typos, my keyboard is too slow for my fingers
well i mean its not like you can do ```html
<script src='main.py'><script>
No, it's not.
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
in general terms
Hey, can someone help me with making my flask webhook listener work
you can't run client side python code in a web browser by visiting a page
so i made this to listen to post requests from a platform, but it doesnt work with my local machine ip url
ive heard of them. what exactly are Flask and Django
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
They're back end python frameworks for web servers. I think you should first review the concept of frontend/backend or rather client/server
You want to host a web server on your local machine?
a public facing web server?
no im actually gonna host it on my vps
@calm grove I think you would benefit from reading this message: #web-development message
thanks i'm looking now
didnt get you
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?
im still developing it on my local, so i'll need to change the code and stuff, but i cant really test it since it doesnt work with my url
you can't do the post requests?
no i havent hosted it on vps
i will but not now
Sorry I still don't have a clear undertanding of the exact problem
there's this platform called repl.it that runs python code online, so i ran my code there and gave that url
ok
the other platform(one sending webhooks) sent the post data to my webserver which is running on repl.it
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)
nope
its another api/website that sends pings when user purchases a product and stuff like that
whats another option?
It's http://127.0.0.1 iirc
yes
i cant actually
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 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
since its a public website that sends these webhooks
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
how do i expose it to the internet?
uhh idk what that means lol
it's not a good idea
hmm
Do you need the post data from the third party platform
so the only other option is hosting it on my vps?
ye i do
vps*
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?
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?
oh ok
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?
nope
oh it does work with an wrapper for google sheets
ya, vps is your best option or generating the requests locally
hey has anybody used dash from plotly here?
like it executes a task(update googles sheets) when it receives the post request from platform
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 !
is it hard to deploy a flask project? i've been thinking about learning flask more
using libraries like gunicorn can make it easy to deploy a project
if you are using static files you will need to configure this with something like nginx or whitenoise
oh, thanks for the info!
needing help with Let's Encrypt?
Corey Schafer has a vid abt hosting a Flask app with Linode
I think it's pretty much the same
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
lets say I have a python set how can I show all the items in a python set to a html list?
you can iterate over the set and create a string based on the content of the html file, then writing that to the file itself!
however it's best to use a templating engine like the one flask/django use
can you guys explain why you can't have websockets with WSGI? Why can't you just handle the request on a thread?
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?
I'm using flask, then?
Or quarts?
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?
if you are using Flask, you should get familiar with their template syntax. it's really cool and powerful, it comes built in as well
typically something like nginx or whitenoise are used to handle static files (css, js, etc.) personally i like using whitenoise because it's fast and easy
http://whitenoise.evans.io/en/stable/flask.html
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)
no need to worry about jinja2, that's handled with a wsgi/asgi server
well, any idea about the redirects issue?