#web-development

2 messages · Page 158 of 1

wooden ruin
#

the development server uses your machine to serve static files from, we would want to have it all be capable from servers

#

wdym?

regal raven
#

the issue i'm actually having is that redirects in flask just send me to localhost

#

it's done this on every flask install i've done

#

no clue why

wooden ruin
#

is this during production?

#

i.e. if the url u are visiting is myapp.com, it redirects you to localhost?

regal raven
#

yes

#

pretty wild IMO

#

i thought it was something regarding server env var config or smth

#

but it's not, ostensibly

native tide
#

Please can you tell me, well also I'm using Jinja, exactly I'm making a discord bot dashboard and i wanted to display all the list of commands, and when i hover over the command it will display it's description, usage, etc

#

For that I'm using quartz, jinja, d.py

wooden ruin
#

i'm not that familiar with quarts. in Jinja you can iterate over a python list as html like this:

#

you will need some sort of web framework/server in order to deploy your site as well if you want to use server side rendering such as jinja

outer apex
regal raven
#

I am indeed not.

#

I literally just booted up Codespaces and did pip install flask followed by flask run

opaque rivet
#

there's an issue with tailwindcss classes being found in pycharm, has anyone had a similar issue?

quick cargo
opaque rivet
calm plume
#

Are you purging the right directories and extensions?

#

And using craco for your scripts (if you're using React)?

opaque rivet
#

^ not sure what this means

calm plume
#

You use React, right?

#

React doesn't support PostCSS Compat 8 yet, so you need to use 7, and for that, you need to use craco for your start and build scripts

opaque rivet
#

i'm using next.js so I followed their guide on setup, I'll retry and if it doesn't work I'll try that. The tailwind.css file doesn't actually include any css just @tailwindcss components (for example - not sure on what that's called) so it's not picked up by intellisense, but all the strange test .css files from tailwind are. anyways, I'll restart my project

calm plume
#

Oh, next? My bad

calm plume
#

Pretty sure you need

@tailwind base;
@tailwind components;
@tailwind utilities;
opaque rivet
#

yeah I've got that, it's just that whatever @tailwind does it's not being picked up by intellisense

#

or something like that

calm plume
#

I don't think PyCharm is officially supported by Tailwind, so it might just be that the autocomplete is wrong

calm plume
#

Oh, I didn't know that

opaque rivet
#

it's not working for me though :(, this is gonna be a thinker

opaque rivet
#

holy crap, I literally got it to work and I have 0 idea why

#

that's good enough for me, hurrah 🥳 🥳

jade lark
opaque rivet
jade lark
#

Sometimes PyCharm is just slow to index files tbh. Sometimes it also doesn't index properly

#

You working with React?

woeful atlas
#

How I can shoot a web page for a few seconds (or make a gif) with selenium?

buoyant shuttle
#

anyone here familar with chart.js

past cipher
#

How to append to a list in Jinja, without calling it?

{% set grouped_products = [] %} ##### List is created
   {% for product in products %}
      {% for product_category in product.category %}
          {% if product_category.category_id == category.id %}
             {% if (product.product_group) %}
                 {% if product.product_group.group.group_name not in grouped_products %}
                     {{ grouped_products.append(product.product_group.group.group_name) }} ## Item added to list
#

It appends it to the list, but it also calls the list because I'm using {{ }} - I just want to append the item to the list

#

nvm sorted it. Always the way after I make a post 😄

silver pollen
#

someone tried using Flask for server sent events? it seems my threads will not close properly and flask eventually crashes

#

i guess because the message queue is blocking, it won't close the threads until a new message is sent if the client is already disconnected?

astral pagoda
#

Can someone help me in help-bread. I have been waiting 30 min. Maybe that is typical wait time. I can't get flask run to work. I tried the obvious. More detail in the help channel

silver pollen
#

@astral pagoda the most obvious to try is to rename your init.py to app.py

astral pagoda
#

okay I made a new help channel in carrot

outer apex
opaque rivet
#

i don't know about you but it takes me so long to create components

#

i'm always debating about the design and then it'll take even more time re-creating the component...

regal raven
#

I am not a fan of spending my time managing convoluted tools

#

presumably the company that acquires me should specialize in such matters :P

vestal hound
opaque rivet
vestal hound
#

iterating in a design tol

#

is generally faster than doing so in code

opaque rivet
#

mm very true

#

any good wireframing tools in mind? is figma overkill?

vestal hound
#

uh

#

okay honestly?

#

I do drawings

#

like physical ones

#

LOL

#

use whatever works for you

opaque rivet
#

😂 I didn't expect that ngl

vestal hound
#

like really simple ones

wooden path
#

Hello, I'm not sure if this is the right spot for this, but I'm attempting to host a web-app online, and am using a MySQL database that's done through Google Cloud Platform's SQL. I have connected to it via Flask-SQLAlchemy, but I am having trouble actually creating the tables. I also posted this in #databases, but I think this might be a better spot. For some more general information, the application itself is built on Flask_RESTful

When running locally, I can just do as follows, but with my understanding, this code is not run when being deployed through Google App Engine.

if __name__ == "__main__":
    db.create_all()
    app.run(host='127.0.0.1', port=5000, debug=True)

The error that I'm getting through GCP is ProgrammingError: (1146, "Table 'file_info.file_indices' doesn't exist") so I'm assuming that the db.create_all() code hasn't run. The issue is, I'm not quite sure how I can run it, as it appears that I only need this to be run once in the Flask app.

Here is the database model:

class FileIndices(db.Model):
    _id = db.Column(db.Integer, primary_key=True)
    user = db.Column('user', db.String(80), unique=False, nullable=False)
    filename = db.Column('filename', db.String(200), unique=False, nullable=False)
    file_info = db.Column('file_info', db.String(500), unique=False, nullable=True)
    file_type = db.Column('file_type', db.String(20), unique=False, nullable=False)
    summary_generated = db.Column('summary_generated', db.Boolean, unique=False, nullable=False)
    transcript_generated = db.Column('transcript_generated', db.Boolean, unique=False, nullable=True)

    def __init__(self, user, filename, file_info, file_type, summary_generated, transcript_generated):
        self.user = user
        self.filename = filename
        self.file_info = file_info
        self.file_type = file_type
        self.summary_generated = summary_generated
        self.transcript_generated = transcript_generated

vestal hound
wooden path
#

I'm assuming so

#

either that, or once when the application is deployed

vestal hound
#

that's run once every startup

#

and if you wanna horizontally scale in the future...

#

put it in a separate script

#

and run that.

wooden path
#

at the moment, it's not running at all

vestal hound
#

once, manually

wooden path
#

so i'm not quite sure how to run it manually since it's on google app engine

#

if it was a vm it probably would've been easy, but google app engine is a bit odd

vestal hound
#

okay so the issue here is

#

there's no automated migration management

#

on Django there is so all of this is taken care of for you

#

you could add additional logic

#

that basically amounts to

#

"if database not created then do it"

wooden path
#

yeah i saw something like that, but i'm not quite sure where to put it and where it wil run

#

i could try putting it in the script itself

jade lark
valid girder
#

We are thrilled to announce the launch of Imagine.ai - a platform where you can generate production-ready Django code in seconds.

Just set up your project preferences and define your data models in our UI, and we generate a code base (including working REST / GrahphQL APIs), that is fully tested, dockerized, linted and more - instantly. Our goal is to generate clean, well-written Django starter code that works out-of-the-box, so you can save time and focus on writing custom business logic.

We’re still at an early stage and we're working hard to build a platform that’s useful & interesting for developers - so we’d appreciate all the feedback you can give us! Please reach out to us through our Discord or Slack with any questions, suggestions or even just learning more about the platform.

Also, learn more about our competition where you can win a cash prize by building a Django project using Imagine.

https://www.imagine.ai/docs/code-with-imagine-competition

Win a cash prize by submitting a Django or Node project built using Imagine!

calm plume
#

I saw that in the Blitz.js server (or was it Next.js), seems really interesting.

valid girder
#

Thanks! Did you have any thoughts about the tool? Any features you'd like to see added?

calm plume
#

I haven't taken too close of a look at it yet, but I'll do so when I have some time.

vestal hound
#

did you check with mods whether it's considered advertising though?

valid girder
#

Oh it's a free tool. Sorry I can check

thorn nexus
#

I am returning a valid HTML string that I'm rendering in a template, but specific {% ....%} are redendering as a literal, even after applying safe filter.

return "<button type='submit' class='button  value='Save'>Save<svg class='icon'>{% load static %}<use xlink:href='{% static 'svg/icons.svg' %}#save'></use></svg></button>"

I am redering like this {{ html_string|safe }}
{% load static %} and {% static 'svg/icons.svg' %} are rendering as literal strings, not processed by django template engine

native tide
lavish prismBOT
#

templates/view.html line 12

{% block new %}```
native tide
vivid cairn
#

Hi, someone uses django ?

inland oak
wooden ruin
#

^^

#

nothing better than good old django imo

vivid cairn
#

Now im learning

inland oak
#

I forced my company to choose as main framework Django instead of Flask)

#

As one of reasons, to get practice for myself. As another reason... job is done 10 times faster with Django. And 2 times better quality

#

There are some other competitive frameworks though

#

I hear and read a lot of good about Fast API, wishing to try it as next framework to play with

native tide
#

I have a doubt related to Django can someone please help me

lavish prismBOT
native tide
versed python
#

@native tide show code

inland oak
#

I heard its common mistake for some language native speakers, not remembering which one

inland oak
#

Books_ground.objects.all().get(date=date).first()

versed python
#

that won't work

inland oak
#

not sure if all() is necessary though

versed python
#

the error will still be raised

versed python
inland oak
native tide
native tide
versed python
native tide
native tide
versed python
#

I want you to explain what you are trying to do

#

well i shuld tell you what you are doing wrong

#

when you do MyModel.objects.get(some_field=some_val) then it is mandatory that only one object is returned. You are however filtering on the basis of date. Two or more books can have the same date and so more than one object (2 in this case) are returned.

To fix this, you will have to use a more unique field for the filter. Try doing it via the id field.

There is also the MyModel.objects.filter() which will return zero or more objects. Maybe that is what you need. I can't really tell.

inland stirrup
inland stirrup
#

!close

native tide
versed python
native tide
native tide
versed python
#

can you show ss?

native tide
versed python
# native tide

The error is very obvious. Look into the python docs about how to format dates

native tide
#

Ok thank u

#

Can't thank you enough

#

💋

quiet kite
#

Hi
Side project in progress !
I think i will go with FastAPI + VueJS for it. Anyone mind sharing some advices, warnings, experiences... before i go 🙂 ?

native tide
versed python
native tide
versed python
#

Can you paste some of the relevant code here?

#

!paste

lavish prismBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pydis.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

native tide
versed python
native tide
versed python
#

do you have a github link?

native tide
#

No...can I send a zip file

versed python
#

alright

#

DM

lavish prismBOT
#

Hey @native tide!

It looks like you tried to attach file type(s) that we do not allow (.rar). We currently allow the following file types: .gif, .jpg, .jpeg, .mov, .mp4, .mpg, .png, .mp3, .wav, .ogg, .webm, .webp, .flac, .m4a.

Feel free to ask in #community-meta if you think this is a mistake.

native tide
wild torrent
#

hey guyz, you can check our blog about FastAPI

#

from official Azerbaijan Python Users Group

raw sluice
#

any django developers here ?

calm plume
#

No need to ask, what's your question?

raw sluice
#

i am making a query from models.py and it shows that obect is not iterable

#

object*

#
class Testdetails(models.Model):
    testid = models.ForeignKey(Testscores, on_delete=models.CASCADE)
    subid = models.ForeignKey(Subject, on_delete=models.CASCADE)
    percent = models.CharField(max_length=100)
    userid = models.ForeignKey(Users, on_delete=models.CASCADE)

    def __str__(self):
        return str(self.testid)

this is the model

#

tdetails = Testdetails.objects.filter(userid=1).order_by('-testid')[0]
and this the query i am trying

#

I want to access subid after this query

#

any solutions ? pls help!

winged zenith
#

I recently just got a website designed for me on Figma. I want to export it to upload it to my shopify store but the designer said you must do some conversion. Bit confused, any ideas?

calm plume
#

Figma won't be able to directly translate to exactly what you want. You'll need to mess around with it a little to fix or change some things so that it can integrate with Shopify.

winged zenith
#

so i would need to get in touch with a front end dev to do this for me?

calm plume
#

If you know some html/css, then it shouldn't be too hard. If you don't know it, and don't want to learn, then yeah, probably.

chrome yew
#

I am having an error called no such table called products_product after running the server. I am using django. Actually I reset my laptop and every python setup was gone. I installed python latest version. Previously it had python 3.6 . The project was running perfectly but after resetting my laptop every model object I retrieve or create It says no such table exist

#

The error doesn't occur when i create a new project. It is just happening to the current project i am working

native tide
native tide
#

Can some one explain me what query string is and why every url has ? In it

#

Like this

surreal portal
#

Does anybody has a good Discord channel for anything JS frontend related? Speaking as a React beginner because I'm lost with the hooks

woeful atlas
#

How can I download castro on raspberry ?

#

because

#
    from castro import Castro
  File "/home/pi/.local/lib/python3.7/site-packages/castro/__init__.py", line 10, in <module>
    import lib.messageboard as mb
ModuleNotFoundError: No module named 'lib.messageboard'```
surreal portal
#

thank you!

native tide
# native tide Like this

I really like that here some people who are experts and know this wont explain but when they need help they want others to explain

opaque rivet
dusk portal
#

hey how can i do that if anyone donates in my site , so it show it in my other (donaters.html) , ik that fetch function but patreon is not my site (lol) so how will i know who donated ;-;
and how can i make sign up page backend ;-; , which stores user idp and data + with there username

empty crane
#

is learning learning python from w3schools enough to get started with django?

calm plume
#

Please don't learn Python from w3schools. w3schools is a reference, not a place to learn.

#

Below, a lot of really good places to learn are linked

lavish prismBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

native tide
#

is anyone knows what is wrong with my setup? There is no error but the app doesn't run

woeful atlas
#

do you know a tool like selenium that supports apython video recording?

graceful flax
#

Hi

solemn glacier
#

Hello

graceful flax
#

I'm using django and have email based login methods

#

Do I use the default user model or create my own ?

#

I'd like to have a level of roles for each user

dull pier
dull pier
graceful flax
#

currently userlooks like thsi

dull pier
graceful flax
#

Okay thanks!

dusk portal
#

try

opaque rivet
#

Instead, you're better off extending the user model instead of creating your own. It will save you a lot of headache and allow you to keep the same methods as the default User model.

jaunty stone
#

What to study in Python to get hired for a junior position here in web-dev?

dull pier
# jaunty stone What to study in Python to get hired for a junior position here in web-dev?

there is a famous question "what all happens when you type google.com in browser". There's a git repo to answer that question. Choose the depth that you can quickly comprehend and study each component in that answer. For example, what web browsers do, what is domain, what is dns, what is http, what is http request, what is http server, what is application, what is rendering template, what is html, css, js, what is http response. First couple of iterations on this path should be more than sufficient. Choose a simple Python framework like flask for reference and easily do each step. Done! you are a full stack junior web developer

#

when you study each of those components in depth, slowly you will turn into a senior web developer

native tide
dusk portal
native tide
#

yes

#

and my vs code was a wrong setup

inland stirrup
#

ec2 is not connecting via ssh after setting up apache2 server on it somebody help

weary pond
#

hello there, can i find here in Django dev that is quite familiar with Django library's ?

worn mural
#

u can

inland stirrup
#

Ssh inbound is open everywhere and outbound is all traffic allowed

graceful flax
#

But the staff status and stuff is still there

native tide
#

#bot-commands

woeful atlas
#

Do you know of any software (like selenium) that can simulate a browser, functional on vps that can take video (or screen very quickly) and simulate keys

woeful atlas
rough tusk
#

am trying to automate the purchase of shares on the website Predictit. My code is currently finding optimal markets to invest in but I'm struggling to automate the purchase of shares because the URL is different every time. The website doesn't have an API so is there any way to automate or scrape the website.

here is a link to the website: https://www.predictit.org/markets

thick cove
#

I see tons of performance comparisons between web frameworks, but none regarding websockets, anyone got some?

twin hamlet
#

Hello

#

I need help which is related to Django framework

quick cargo
thick cove
#

yeah alright

#

Just any asgi spec framework should be good then

quick cargo
#

Mhmm

silk prism
#

so can ANY kind of data be used with websockets? and JSON is just the most commonly used? like can you use XML over websockets or just plaintext? or does websockets need to be JSON?

vestal hound
#

you can send whatever you want

#

strings or binary data are both fine

sturdy marten
#

I am learning Django using the ebook "beginning django: web application development and deployment with python"

#

Anyone else followed this path?

cold estuary
#

i am building a simple weather app that shows only temp for current and hourly wise using flask as a backend

#

This is how i show the data from API to the frontend in this way how can i show the dt field from API response which is in Unix time into 12hr format

sage bluff
#

guys how do i store this img , i got this from the frontend data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA54A…kBE8AAACSEjwBAABIKIT/BxTJ43TF9pn+AAAAAElFTkSuQmCC

keen berry
#

guys do companies need to pay money when they message you to verify your phone number

like say when you sign up to instagram, they verify your phone number by sending you an sms

#

so does this cost money

sage bluff
hollow mulch
#

yes

glacial crest
#

Hey Guys!!! I am just trying web development in Python using flask. I just created everything, but when I try to register and login it says "CSRF tokens are missing". What should I do here?

glacial crest
#

Thank you!!

sage bluff
#

np

midnight hill
#

Hey guys, I have honed my python skills and now want to learn Flask, however I do not have the energy to sit through a teacher/lectures teaching it. Any recommendations where Flask can be learnt through reading/blogs/more reading based approach?

sturdy marten
# midnight hill Hey guys, I have honed my python skills and now want to learn Flask, however I d...
#

Research on browsers compatibility.

midnight hill
#

Thanks for your response @sturdy marten . Have you read this manual? Do you recommend it?

sturdy marten
midnight hill
#

I am a complete beginner to all of this. Is Django better than flask?

dusk portal
#

hey

#

i too and still doing it

#

😛

sturdy marten
#

Ohh I meant to say, you need to make research on which one is best compatible with browsers these days. Amongst other requirements

sturdy marten
#

Although am sure seasoned programmers would give you specific differences between them.

dusk portal
#

yes django for sure is better but it does spoon feeding and do things automatic but user should know whats happening in bg like db and connecting things in flask we have to do it ourself so our db part and things get good and u will never face issues while doing django , i strongly recommend flask first

#

@fickle reef

dusk portal
#

good luck , u will face issues while connecting and making db that topic but dont give up for sure u will get it , if u dont get try again again and again but dont gove up

dusk portal
sturdy marten
#

Hi

dusk portal
#

so i have been learning flask from months

#

and now i wanted to switch to django

#

but i have some questions

sturdy marten
#

What resources do you use, I don't mind trying it too

dusk portal
#

my flask is clear leaving a few things

dusk portal
sturdy marten
dusk portal
#

for flask

sturdy marten
dusk portal
#

ik django basics

#

but first i want to clear flask 101%

sturdy marten
#

The pdf am using for django is quite explanatory

#

That's why I got comfortable learning it

dusk portal
#

how can we make a sign up backend . 2nd how can we ask user for notification as some sites do by flask

#

rather that it ik jinja templating . inheritance , db's , connecting db making db , making a login page , fetching data from db , message flashing , make rest api

#

connecting with mail

#

and all the things

#

just have 2 questions

sturdy marten
#

For django you mean?

dusk portal
#

this is stopping me to give myserf 101% on django , so i came back at flask to learn

#

nope in flask

sturdy marten
#

Ohh. No no. Sorry bro

#

Django path for now

dusk portal
#

ok tell me django , cez i want to be good at django too

sturdy marten
#

After that, I'm trying fastApi.

Basically I'm into django for web development.
But then again want to use another technology to handle api development

sturdy marten
dusk portal
#

i understand but

#

u r good at django

#

and im good at flask

#

👍

sturdy marten
#

Yeah. Knowledge sharing

#

We'll certainly keep up. Am tryna be active in a community

dusk portal
#

ok lemme open my django file and, lesgoo!!

#

yes added u friend

#

u from? @sturdy marten

sturdy marten
#

Nigeria.

dusk portal
#

oh im from India and im 15

sturdy marten
#

Ohh. Alright

#

We'll keep in touch, have to join a meeting

dusk portal
#

ok

#

good bye

#

cya

arctic temple
#

Hello
Is there any way in django to use a view inside another view?
For example let's say i have a HomeView and a PostListView
PostListView gets all the posts from the database and renders them in some way
i want to add that post list inside HomeView to avoid creating a context variable with the items in each view i render the list
is it possible?

#

or is there another approach?

dull pier
#

it also depends on how often you expect code change in this area of your codebase. if it's like write once and forget then code duplication is okay. In certain cases following the rule of 3 (don't abstract unless you are using the same functionality in more than 3places) is actually very beneficial

arctic temple
#

alright thanks

#

im used to the concept of component in javascript frameworks and this is a bit weird

#

another one.. just to confirm
in order to change the context variables in class based i need to override get_context_data right?

arctic temple
#

thanks!

opaque rivet
#

@arctic temple you can have the view as an API, and make a request (a side effect) to return data from that secondary view.

digital hinge
#

Anyone know of a flask powerpoint to jpg converter?

opaque rivet
#

Let's say you had ASGI django with no middleware. How would this compare with the speeds of FastAPI?

dusk portal
#

hey

#

anyone's up?

solemn glacier
#

what up

surreal portal
#

Anybody used GeoDjango?

native tide
#

https://slambook-py.herokuapp.com/nuc2vir
django app
its a type of a game
you can create a set of 10 questions and then share a unique link to your friends to answer them | and you can view those answer!!!
Thanks👀

I want suggestions for this to imporove ! NOt a advertisement

calm plume
north aurora
#

Hey, Does anyone know how to show an image in the background of a div by selecting it from input file tag?

#

using Javascript

eternal blade
#

What's the difference between HyperlinkedModelSerializer and ModelSerializer in django rest framework?

north aurora
#

I tried it in this way but didn't worked.
Anyone knows how to do it?

sage bluff
#

guys i tried to make the navbar to be fixed but how do i make that first card to show fully , if i change the navbar to static its showing the first card fully

#

nvm that was a stupid question

mellow kettle
#

Hi so I want to add users to a group but I can't save the users because I get this error
'FIELD ID EXPECTED A NUMBER BUT GOT A ()'

#

I'm uding django

#

Using

woeful vapor
#

Is Gunicorn + Gevent (monkeypatch.all) still relevant? Or is there something better out there. I'm trying to scale up my flask backend to support a high number of RPS but having some troubles benchmarking and finding the bottlenecks.

quick cargo
# woeful vapor Is Gunicorn + Gevent (monkeypatch.all) still relevant? Or is there something be...

Generally, your IO will still be the slowest thing followed by the data transactions. In terms of relevent yes gevent is still relevant and alot of companies use flask and that setup because it makes flask very performant in real world situations. In terms of new kid on the block, ASGI systems / asyncio in Python is alot more popular now days because its explicit and directly integrated in python which makes life easier for developers (it's also a bit more efficient) but it does generally require re-writing your entire backend from the ground up to make it worth using

#

Gevent will likely give you plenty of extra wiggle room and it's still what most flask apis will use today e.g. discord

dull pier
chilly falcon
#

how to insert image in django html
image is in http://127.0.0.1:8000/media/wishrecoder1.PNG
location and i want some other method to include image in html so that if i change port or ip i dont have to come to html and change the src
<img src="http://127.0.0.1:8000/media/wishrecoder1.PNG" class="carousel-image" alt="page1">

woeful vapor
woeful vapor
quick cargo
#

10k requests per second is a metric fuck ton

woeful vapor
#

frontend is going to make about 100> per user

quick cargo
#

in production 10k rps is top 5% website level of big

chilly falcon
#

i was doing server side

dull pier
quick cargo
#

Wikipedia gets less requests per second than 10k bloblul

dull pier
woeful vapor
#

because if I just do async resquests.posts I get my singel response back in about 10-20s

quick cargo
#

bearing in mine 10krps is 300 BILLION requests a year

woeful vapor
#

but the browser is taking 50s

dull pier
#

you should look at a persistent websocket opened. that way you get much better transport option

quick cargo
#

what are you doing on each of these requests?

#

generally i avoid websockets at all costs

#

because they scale awfully

woeful vapor
dull pier
#

yeah, what's your use case like? dynamic apps with that sort of velocity would definitely justify something like react/angular with websocket/webtransport

woeful vapor
#

so I'm making a bunch of calls to the blockchain network and then erturning the response.

dull pier
#

i meant to quote you on your websocket doesn't scale remark*

quick cargo
#

generally, I think sending the calls to the blockchain network is gonna be your bottlekneck

quick cargo
# dull pier i meant to quote you on your websocket doesn't scale remark*

Pretty standard:

  • Once a connection is made it cant be re-shuffled without reconnecting
  • Each connection holds that port up all the time even when its not doing anything.
  • Websocket connections generally are also very hard to cache on the proxy side and proxy caching is your best friend at scale
woeful vapor
#

would encorping a redis queue in the mix just cause more headaches or actually be benificial

quick cargo
#

well i wouldnt necessarily say a redis queue because stuff is still gonna take about the same time, but are you able to cache the responses for a given amount of time?

quick cargo
#

So if you send a request to the blockchain network

#

are you able to save its response for a bit, and then future requests use that data for a little bit before re-fetching

#

the Time to live can be very small

#

but it means that under much higher load you send less requests to the network and instead hit the cache which will likely be quicker

woeful vapor
#

I guess in theory yes but pricing data is important in this realm

surreal portal
#

Anybody in Web geographical apps? Because I was wondering if leaflet + GeoDjango would be a good combo

dull pier
#

@woeful vapor what is your request flow like? 100req from client to your server which propagate to blockchain networks?

quick cargo
woeful vapor
quick cargo
#

Imo i would make it cache the response for as long as you can without making the data invalid

#

so that under high load

#

most of the requests will hit the cache rather than sending another request and waiting for non-local IO

#

because a locally hosted redis/keydb instance will a couple ms at most (generally less than 1 ms)

dusk portal
#

hey need a small help ,i already 1 login panel how can i create 1 more login page

#

by flask

woeful vapor
scenic vapor
#

whats the standard size limit for a file (png jpg) for users to upload on a webapp?

ember kayak
#

ok, why do i need a hosting service for flask?

dusk portal
#

whenever i use this html file it gives -302 error idk why

lavish prismBOT
#

Hey @dusk portal!

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

calm plume
#

@nimble dawn About your question in #career-advice, just know that you should never use document.write()

#

console.log() is the correct way to print.

dusk portal
#
@app.route("/login",methods=["GET","POST"])
def login():
    if 'uname' in session and session ['uname'] ==params['admin-user']:
        return render_template("admin.html",params=params)
    if request.method == "POST":
        username=request.form.get('username')
        password=request.form.get('password')
        session['uname']=username
        if username==params['admin-user'] and password==params['admin-pass']:
            return redirect("/admin",params=params)
    else:
        return redirect("/login")        
    return render_template('login.html',params=params)

@app.route("/admin")
def admin():
    if 'uname' in session and session ['uname'] ==params['admin-user']:
        report=Contacts.query.all()
        return render_template('admin.html',params=params,report=report)
    else:
        return redirect("/login")```
#

login.html is contains a login form and admin.html contains page which logged in user can see so

#

127.0.0.1 - - [21/May/2021 21:23:20] "GET /login HTTP/1.1" 302 -

#

why i always face this issues

#

and when im opening login.html not in my flask app(server) its opening

#

;-;

solemn glacier
#

@dusk portal sup

dusk portal
#

@solemn glacier

#

how can i fix

#

noone here to help , WoW

#

lol

solemn glacier
#

When do you get the error

#

when you do what action

#

on redirect()?

dusk portal
#

when i open site on my flask app

#

and when i open html file single

#

it opens

dusk portal
#

if u dont mind

#

i would like to present screen

solemn glacier
#

i can't sorry just text

#

ignore the html only. focus on the flask server

#

does any page load

#

like when do you get the 302

#

after you login?

#

or when you load the page

dusk portal
#

yes thats the issue

#

when i open that page

#

it reloads and show -302

solemn glacier
#

/login?

dusk portal
#

This page isn’t working127.0.0.1 redirected you too many times.
Try clearing your cookies.
ERR_TOO_MANY_REDIRECTS

dusk portal
solemn glacier
#

i see why

dusk portal
#

oh tell plz

solemn glacier
#

one minute

dusk portal
#

ok

#

sure

nimble dawn
#

Thanks

solemn glacier
#

@dusk portal

dusk portal
#

oh done? @solemn glacier

solemn glacier
#
@app.route("/login",methods=["GET","POST"])
def login():
    if 'uname' in session and session ['uname'] ==params['admin-user']:
        return render_template("admin.html",params=params) # you may want to redirect instead of render
    if request.method == "POST":
        username=request.form.get('username')
        password=request.form.get('password')
        session['uname']=username
        if username==params['admin-user'] and password==params['admin-pass']:
            return redirect("/admin",params=params)
        else:
            return redirect("/login")        
    return render_template('login.html',params=params)

@app.route("/admin")
def admin():
    if 'uname' in session and session ['uname'] ==params['admin-user']:
        report=Contacts.query.all()
        return render_template('admin.html',params=params,report=report)
    else:
        return redirect("/login")
dusk portal
#

wheres the problem

solemn glacier
#

se the comment too

#

else on line 11

#

should have been indented

#

try it

#

if it doesn't work let me know

dusk portal
#

lemme try

solemn glacier
#

you had a redirect loop

#

you were redirecting to /login on a get request to /login

dusk portal
#

damn

#

insane!!!

solemn glacier
#

worked?

dusk portal
#

how plz tell

#

yes

#

!!!

#

what was my mistake

#

can u mark tha

solemn glacier
#

look:

#

this is the new code

dusk portal
#

oh damn

solemn glacier
#
def login():
    if 'uname' in session and session ['uname'] ==params['admin-user']:
        return render_template("admin.html",params=params) # <-- you may want to redirect instead of render [READ ME]
    if request.method == "POST":
        username=request.form.get('username')
        password=request.form.get('password')
        session['uname']=username
        if username==params['admin-user'] and password==params['admin-pass']:
            return redirect("/admin",params=params)
        else: # < -- this wasn't indented it was it was an else for the "if request.method == "POST":" so when you made a GET it just loops the redirect over again
            return redirect("/login") # and this^    
    return render_template('login.html',params=params)
#

see comments

proud quiver
#

Hi

dusk portal
#

oh lol i saw

#

the problem was

#

i putted 1st if then indent then 2nd and 3rd in indent but 4th on 1st indent place

#

lol

solemn glacier
#

check out flask-sessions

#

it may help with what you're doing

random lava
#

Hi, im using python flask as my backend.
im returning a value in python then displaying it on my html page.

How would i use the python return inside a js tojson?

{{all_test_data|tojson|safe}};
var test = {{all_!python_return!_data|tojson|safe}};

outer apex
#

what does test look like doing that?

random lava
mellow kettle
#

Hi so im adding users to my website through the admin panel and i have custom fields and all but each time i add a user in my group i get this error:

#

Field 'id' expected a number but got ()

outer apex
mellow kettle
#

ill show

#

from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User

class registerForm(UserCreationForm):
first_name = forms.CharField(max_length=30, required=False)
last_name = forms.CharField(max_length=30, required=False)
omang_id = forms.CharField(max_length=30, required=False)
email = forms.EmailField(max_length=254)
phonenumber = forms.CharField(max_length=30, required=False)
city = forms.CharField(max_length=30, required=False)
date_of_birth = forms.CharField(max_length=30, required=False)
address = forms.CharField(max_length=30, required=False)

class Meta:
    model = User
    fields = (
        'username', 'first_name', 'last_name', 'email', 'omang_id', 'city', 'date_of_birth', 'address',
        'phonenumber',
        'password1', 'password2',)
outer apex
#

Can you share the full traceback of that error?

random lava
# outer apex what does `test` look like doing that?

Nvm getting the same thing again.
The returned value of test looks like:

[{"time": 1620949623, "open": 19, "high": 19, "low": 19, "close": 19},{"time": 1620949623, "open": 19, "high": 19, "low": 19, "close": 19}]

#

{{all_test_data|tojson|safe}} works fine i just need to replace the "test" with another value from a for loop

outer apex
#

Sorry, don't quite understand. You're trying to replace something in test with some value from a for loop where?

random lava
#

each "all_test1_data", "all_test2_data" and so on has a different set of dictionaries set to them

manic frost
#

!warn @woven terrace I just told you that we don't allow offers of paid work. If you continue, you'll be removed.

lavish prismBOT
#

:incoming_envelope: :ok_hand: applied warning to @woven terrace.

woven terrace
#

I deleted my messages @manic frost

mellow kettle
lavish prismBOT
#

Hey @mellow kettle!

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

mellow kettle
#

Environment:

Request Method: POST
Request URL: http://127.0.0.1:8000/admin/W/student/add/

Django Version: 3.2
Python Version: 3.8.5
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'W',
'crispy_forms']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']

proud quiver
#

Hi i I will scrap data over a link but this link is not a static link. The link is varies according to the dates. for example: http://www.sgk.gov.tr/wps/portal/sgk/tr/kurumsal/merkez-teskilati/ana_hizmet_birimleri/gss_genel_mudurlugu/anasayfa_duyurular/duyuru_20210512
http://www.sgk.gov.tr/wps/portal/sgk/tr/kurumsal/merkez-teskilati/ana_hizmet_birimleri/gss_genel_mudurlugu/anasayfa_duyurular/duyuru_20210505
This link is only posted every Wednesday and only the last part (date part) of the link changes. How can I access only this link that changes the end each time? And how can I save the excel file in the link and view the data in the form of a table? How should the process steps be ? thanks in advance for the help

mellow kettle
#

Traceback (most recent call last):
File "C:\Users\BIDA19-040\PycharmProjects\drivingTP\lib\site-packages\django\db\models\fields_init_.py", line 1823, in get_prep_value
return int(value)

The above exception (int() argument must be a string, a bytes-like object or a number, not 'tuple') was the direct cause of the following exception:
File "C:\Users\BIDA19-040\PycharmProjects\drivingTP\lib\site-packages\django\core\handlers\exception.py", line 47, in inner
response = get_response(request)
File "C:\Users\BIDA19-040\PycharmProjects\drivingTP\lib\site-packages\django\core\handlers\base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\BIDA19-040\PycharmProjects\drivingTP\lib\site-packages\django\contrib\admin\options.py", line 616, in wrapper
return self.admin_site.admin_view(view)(*args, **kwargs)
File "C:\Users\BIDA19-040\PycharmProjects\drivingTP\lib\site-packages\django\utils\decorators.py", line 130, in _wrapped_view
response = view_func(request, *args, **kwargs)

#

File "C:\Users\BIDA19-040\PycharmProjects\drivingTP\lib\site-packages\django\views\decorators\cache.py", line 44, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
File "C:\Users\BIDA19-040\PycharmProjects\drivingTP\lib\site-packages\django\contrib\admin\sites.py", line 232, in inner
return view(request, *args, **kwargs)
File "C:\Users\BIDA19-040\PycharmProjects\drivingTP\lib\site-packages\django\contrib\admin\options.py", line 1655, in add_view
return self.changeform_view(request, None, form_url, extra_context)
File "C:\Users\BIDA19-040\PycharmProjects\drivingTP\lib\site-packages\django\utils\decorators.py", line 43, in _wrapper
return bound_method(*args, **kwargs)
File "C:\Users\BIDA19-040\PycharmProjects\drivingTP\lib\site-packages\django\utils\decorators.py", line 130, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "C:\Users\BIDA19-040\PycharmProjects\drivingTP\lib\site-packages\django\contrib\admin\options.py", line 1538, in changeform_view
return self._changeform_view(request, object_id, form_url, extra_context)
File "C:\Users\BIDA19-040\PycharmProjects\drivingTP\lib\site-packages\django\contrib\admin\options.py", line 1584, in _changeform_view
self.save_model(request, new_object, form, not add)
File "C:\Users\BIDA19-040\PycharmProjects\drivingTP\lib\site-packages\django\contrib\admin\options.py", line 1097, in save_model
obj.save()

#

File "C:\Users\BIDA19-040\PycharmProjects\drivingTP\lib\site-packages\django\db\models\base.py", line 726, in save
self.save_base(using=using, force_insert=force_insert,
File "C:\Users\BIDA19-040\PycharmProjects\drivingTP\lib\site-packages\django\db\models\base.py", line 763, in save_base
updated = self._save_table(
File "C:\Users\BIDA19-040\PycharmProjects\drivingTP\lib\site-packages\django\db\models\base.py", line 845, in _save_table
updated = self._do_update(base_qs, using, pk_val, values, update_fields,
File "C:\Users\BIDA19-040\PycharmProjects\drivingTP\lib\site-packages\django\db\models\base.py", line 879, in _do_update
filtered = base_qs.filter(pk=pk_val)
File "C:\Users\BIDA19-040\PycharmProjects\drivingTP\lib\site-packages\django\db\models\query.py", line 941, in filter
return self._filter_or_exclude(False, args, kwargs)
File "C:\Users\BIDA19-040\PycharmProjects\drivingTP\lib\site-packages\django\db\models\query.py", line 961, in _filter_or_exclude
clone._filter_or_exclude_inplace(negate, args, kwargs)
File "C:\Users\BIDA19-040\PycharmProjects\drivingTP\lib\site-packages\django\db\models\query.py", line 968, in _filter_or_exclude_inplace
self._query.add_q(Q(*args, **kwargs))
File "C:\Users\BIDA19-040\PycharmProjects\drivingTP\lib\site-packages\django\db\models\sql\query.py", line 1396, in add_q
clause, _ = self._add_q(q_object, self.used_aliases)
File "C:\Users\BIDA19-040\PycharmProjects\drivingTP\lib\site-packages\django\db\models\sql\query.py", line 1415, in _add_q
child_clause, needed_inner = self.build_filter(
File "C:\Users\BIDA19-040\PycharmProjects\drivingTP\lib\site-packages\django\db\models\sql\query.py", line 1350, in build_filter
condition = self.build_lookup(lookups, col, value)

#

File "C:\Users\BIDA19-040\PycharmProjects\drivingTP\lib\site-packages\django\db\models\sql\query.py", line 1196, in build_lookup
lookup = lookup_class(lhs, rhs)
File "C:\Users\BIDA19-040\PycharmProjects\drivingTP\lib\site-packages\django\db\models\lookups.py", line 25, in init
self.rhs = self.get_prep_lookup()
File "C:\Users\BIDA19-040\PycharmProjects\drivingTP\lib\site-packages\django\db\models\lookups.py", line 77, in get_prep_lookup
return self.lhs.output_field.get_prep_value(self.rhs)
File "C:\Users\BIDA19-040\PycharmProjects\drivingTP\lib\site-packages\django\db\models\fields_init_.py", line 1825, in get_prep_value
raise e.class(

Exception Type: TypeError at /admin/W/student/add/
Exception Value: Field 'id' expected a number but got ().

worn mural
#

Then you make a request to the url

#

Scrap the data you want

#

To work around with excel take a look at pandas

#

You can print a table with pandas

#

And you only need the link to the excel file to access the data

solid goblet
#

besides fiverr, where can i find people to make a website for me, are their any discords or anything?

inland oak
solid goblet
#

thanks

dusk portal
#

hey ]

#

anyone's up ?

keen citrus
#

hello
i was creating an app to download video from https://mover.uz but I got stuck that my soup can not find "video" tag even it excist

from bs4 import BeautifulSoup as bs
import os
import io
from base_func import *

# from kivy.app import App
# from kivy.uix.video import

a = load_url_string("https://mover.uz", "GET")
a = a.find_all("section", class_="index-featured")
a = bs(str(a), "html5lib")
c = list(a.div.contents)
type(c[1])
type(c)
c[1].div.a.img["data-live-preview-src"]  # video preview video link
c[1].div.a["href"]  # video link
c[1].div.a.img["src"]  # video picture link
# len(a.div.contents)
# for i in c:
#    print(i.div.a.img["data-live-preview-src"])

# /html/body/div[1]/main/div[1]/div[1]/div[1]/div/div/pjsdiv/pjsdiv[1]/video
v = load_url_string(c[1].div.a["href"], "GET")
# v.find_all("iframe", class_="video")
# print(v.find(string = c[1].div.a["href"]))

"""here I could not find vide tag"""

g = v.find("video")

#

this is my bas_func:

import urllib3
from bs4 import BeautifulSoup
import io
import os


def load_url_string(url1: str = "url should be a string", method: str = "GET") -> None:

    http = urllib3.PoolManager()
    r = http.request("GET", url1)
    s = r.data.decode("utf-8")
    return BeautifulSoup(s, "html5lib")

this is a part of html that i can not find

<video style="position: static; top: 0px; left: 0px; width: 100%; height: 100%; object-fit: contain; transition: filter 0.2s linear 0s; min-height: auto; max-height: none; min-width: auto; max-width: none;" src="https://v.mover.uz/KEVHlF8g_h.mp4" x-webkit-airplay="allow" pip="false" preload="none" autoplay="0"></video>
opaque rivet
#

@mellow kettle did you read what the error told you?

proud quiver
native tide
#

does some one know how to dou delete request

#
 def do_ge(self): 
def do_POST(self): 
#

does do_delete exist

mellow kettle
opaque rivet
native tide
#

settings.py

STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATIC_URL = '/static/'
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'components/media')

STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'components/static'),
]

STATICFILES_STORAGE = 'whitenoise.storage.CompressedStaticFilesStorage'

urls.py

if settings.DEBUG:
    urlpatterns += (
        static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) +
        static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
    )
eternal blade
#

What are the differences between ModelSerializer and HyperlinkedModelSerializer in django reast

nimble epoch
native tide
#

is there a like a way to do this part?

opaque rivet
proud lintel
#

Hi, I need one help. I have to upload more than one image for a product, number of images is not fixed. How can I write a model for it.

class Product(models.Model):
    name = models.CharField(max_length=100)
    product_image = models.ImageField(upload_to='product_image/', null=True, blank=True)
    price = models.PositiveIntegerField()
    description = models.TextField()

    def __str__(self):
        return self.name

This is for one image per product , but I need multiple images for one product.

native tide
mental field
#

When I try to use vuejs for frontend and django for backend
While using axis in vie to get images from the django server no picture shows up why?

mental field
#

Then create a that number of imagefields

willow torrent
#

I am using django to build an simple app. By default time zone was UTC I changed it to Europe/Istanbul.
If I deployed that app on like Heroku. Will it changes date format ?

willow torrent
mental field
#

I guess

willow torrent
#

😅 I didn't knew that shortcut. Thanks anyway

mental field
#

Also make sure to use datetime.datetime.utcnow()

willow torrent
mental field
#

Of you use that it won't give you errors when deploying in heroku

#

Follow the answers here

native tide
#

how do i make this into a page that works for all codes

@app.errorhandler(404)
def errorpage(e):
  return render_template('error.html', error=404)```
#

flask

paper pier
#

any django resource recommendation for beginner ?

native tide
#

pls help

normal notch
#

i want help in mobile app development, can i get guidance? please ping me

raven relic
#

Can I learn vue directly without learning bootstrap?

paper pier
distant charm
#

can i talk about react here?

#

need a little help with useState

native tide
#

ok

opaque rivet
opaque rivet
distant charm
#

so i am trying to update the states

#

but it's not working for some reason

opaque rivet
#

Because the initial state is username and password is "", the initial if statement is always false.

#

How can you check that the state equals a value (e.g. "username") without ever setting the state beforehand?

#

It's a catch 22

worn mural
distant charm
#

it does change in my code i have input fields which set the values

opaque rivet
#

well you should show more code then

#

!code

lavish prismBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

distant charm
#

will be messy so

opaque rivet
#

well, at least the state part of it

distant charm
#

so the text in the input field does change for you?

opaque rivet
distant charm
#

ahh nvm fixed it

opaque rivet
#

so what "didn't work"?

distant charm
#

so basically the value of the input fields was not updating as i never set the value of input fields in the first place

calm plume
opaque rivet
#

just know that if you're printing your state, state gets updated async.

#

so even if you "think" your state isn't updated because you console.log'd somewhere in an effect and it's a stale value, it just means that the state gets updated at the end of the event loop

#

but your code works

jolly star
#

how do i open my flask project to LAN
i googled it but none of them worked ( i am using port 5000)

normal notch
#

Technically speaking , I wanna develop an android app using AI software , and I guess python would do the AI part .....but I need guidance on how to merge Java and python to make the final product

normal notch
opaque rivet
#

make your mobile application and interface with your ML model as an API

raven relic
jade lark
#

Hopefully someone here has an idea. (Not related to just Python). I have a SaaS that is getting a wave of signups with disposable emails. Does anyone have any suggestions on how to put a stop to it?

I already have a few ideas. But, I wanted to see if there was something out there I wasn't aware of.

dusk portal
#
@app.route("/taskcreator",methods=["GET","POST"])
def taskcreator():
        if 'uname' in session and session['uname'] == params['admin-user1']:
            if (request.method=="POST"):
                title=request.form.get('title')
                content=request.form.get('content')
                phone=request.form.get('phone')
                img_file=request.form.get('img_file')
                entry=Posts(title=title,content=content,phone=phone,img_file=img_file)
                db.session.add(entry)
                db.session.commit()
        return render_template('taskcreator.html')```
#

it reloads taskcreator.html again when i submit form

#

surely problem is in last return statement

native tide
#

how do i add a .ico file as favicon on flask

dusk portal
#

any1 plz help

jade lark
native tide
#

ok

jade lark
native tide
#

in template folder

#

for render_template

jade lark
#

you'll need to include the static file (location)

native tide
#

ok.

#

what do you mean

thorn igloo
native tide
#

i did that but it didnt work

dusk portal
#

;-;

thorn igloo
dusk portal
#

its a return statement (indent of return) statement problem

#

for sure

jolly star
#

how do you add images via css ( i am using flask)

jade lark
native tide
#

thx it works now

jade lark
#

you have it rendering the form again after submit.

jolly star
#
.u-section-1 {
  background-image: linear-gradient(0deg, rgba(0,0,0,0.4), rgba(0,0,0,0.4)),
  url("{{ url_for('static', filename='images/2236553_medium2000.jpg ')}}");
  
  background-position: 50% 50%;
}
#

but it gives this error ```
GET /static/styles/images/2236553_medium2000.jpg HTTP/1.1" 404 -

#

and the file exits btw

proud lintel
dusk portal
#

It is

jade lark
#

What did you want your form to do after submit? Add an element? Redirect? Show a flash/notification?

thorn igloo
jolly star
#

yes

-static
  -scripts
    js stuff
  -images
    all images
  -styles
    css files
#

@thorn igloo

thorn igloo
#

that doesnt seem to exist

#

so i guess the question would be why is there a get request to that location?

jolly star
#

i mean i have put it wrong but i am not sure of the correct order

#

i tried many things but its not working

jolly star
#

the url for is wrong

#

{{ url_for('static', filename='images/2236553_medium2000.jpg ')}} this one

thorn igloo
jolly star
#

yes

thorn igloo
#

doesnt jinja2 work for html files?

#

did you try hardcoding the url instead of using url for?

jolly star
#

yes it was like that previously

#

its because when i do ../

#

that is not working

thorn igloo
#

man, i mean hard coding the url like /static/images/image-name

jolly star
#

yes

#

it still goes to images in styles (none)

thorn igloo
#

then idk, maybe use the style attribute for the element in your html

#

@jolly star maybe one of these can help you

jolly star
#

i just checked the css file via dev tools

#

./images/2236553_medium2000.jpg this is the url in it

#

and its supposed to be ../images/2236553_medium2000.jpg

#

this is what i have in the file /static/images/2236553_medium2000.jpg

#

i am so confused rn

proud quiver
#

@worn mural you think did I explain exactly? by the way, the example does not appear in the link you provided

zenith rose
#

Has anyone had experience using residential proxys with selenium? If you have how have you run them and where did you buy them from

burnt night
#

Where should I go after "Wedge of Django"?

solid goblet
#

question, if anyone has experience with creating website, what is the typical cost for someone to create a website with subscription payments and referral systems?

Just want to get a general idea before i agree to pay someone a months income or something

mint folio
#

If it was me I would scope out the details exactly what’s required, and then see how many hours you would think it would take. Add a buffer on top, and give your estimate.

jade lark
mint folio
lilac nest
#

Hey, if anyone has the time to look my question in mango. I would appreciate it. I know you guys are busy so if you can't I understand. ❤️

small cape
#
oauthlib.oauth2.rfc6749.errors.MismatchingStateError: (mismatching_state) CSRF Warning! State not equal in request and response.
``` Umm What is this error? I am so confused.
jolly star
rare ibex
#

does anyone here know to deploy quart app on windows server? need help with this

native tide
#

any kind of fix for this design

dusk portal
#
@app.route("/taskcreator",methods=["GET","POST"])
def taskcreator():
        if 'uname' in session and session['uname'] == params['admin-user1']:
            if (request.method=="POST"):
                title=request.form.get('title')
                content=request.form.get('content')
                phone=request.form.get('phone')
                img_file=request.form.get('img_file')
                entry=Posts(title=title,content=content,phone=phone,img_file=img_file)
                db.session.add(entry)
                db.session.commit()
        return render_template('taskcreator.html')```
#

when im hitting submit button on form it reloads taskcreator.html instead of sending post req
sad life
im 101% problem is in last return statement

#
<html>
<body>

<h2>Add a Task</h2>

<form action="/taskcreator" method="POST">
  <label for="title">Title</label><br>
  <input type="text" id="title" name="title" ><br>
  <label for="content">Content</label><br>
  <input type="text" id="content" name="content"><br><br>
  <label for="phone">Phone</label><br>
  <input type="text" id="phone" name="phone" ><br><br>
  <label for="img_file">Image</label><br>
  <input type="text" id="img_file" name="img_file"><br><br>
  <input type="submit" value="Submit">
</form> 
</body>
</html>
#

this is html file ping me plz when u solve or u wana try to help

outer apex
dusk portal
#

its not sending req to db

#

its just simple reloading

outer apex
#

but you're trying to submit a POST request no?

scenic vapor
#

Hey guys, what's the best practice for uploading images along with other form data? Should i upload right away after user select the image or after submitting the whole form?

dusk portal
#

@outer apex

outer apex
#

so you want the stuff inside of if request.method == 'POST' to execute correct?

dusk portal
#

@outer apex

#

sorry for late replies

outer apex
#

so, right now, when you submit the form, it's not reaching the stuff inside if request.method == 'POST'?

#

have you double checked if all your conditions are met?

dusk portal
#

yes

#

so what should i do

#

and i have made this like 10 times so im sure

#

i am not wrong in syntax

#

but this time if working with 2 if in post req 1st time

#

if 'uname' in session and session['uname'] == params['admin-user1']:
if (request.method=="POST"):

#

these 2 instead of 1

#

so im damn sure

#

problem is in return statement indent

#

or 1 more return needed

#

but i have tried and cant fig, out

outer apex
#

so all the stuff inside of that request method thing is running?

dusk portal
#

is correct but not running cez of last return problem and when i changed last return to xyz.html

#

it showed xyz.html not found

#

shows prblm is in the last statement for sure

outer apex
#

So do you want to redirect to another page or render a different template, if the method is POST?

dusk portal
#

can i share screen

jovial cloud
#

@native tide You can put office address or the contact us below. Better than side by side

mint folio
glad patrol
#

i have a gridview it has some rows when i update the row it updated succfully i need to change the background color of update row

native tide
peak lava
#

does anyone know how to include my js file in my html code

#

django btw

calm plume
#

@peak lava You can use <script> tags

peak lava
calm plume
#

Can you share the code?

peak lava
#

me?

calm plume
#

Yes

peak lava
#

how

#

want me to ss it or?

calm plume
#

In a code block

#

```html
code
```

peak lava
#

well its reallyyy long yk

calm plume
#

Just the one tag

peak lava
#

the script one

calm plume
#

Yeah

#

If that tag is really long, you should use an external JS file

peak lava
#

<script src="main.js"></script>

calm plume
#

And what's not working?

peak lava
#

its as if ive never included it

#

wait

#
Not Found: /home/main.js
[23/May/2021 15:14:39] "GET /home/main.js HTTP/1.1" 404 2481
fallen kindle
#

elementary question, getting this error:
The current path, notify/1/vote/, didn’t match any of these.

views.py

    return HttpResponse("You're voting on question {}.".format(question_id))```

urls.py
```path('<int:question_id/vote/', views.vote, name='vote'),``` #urlpatter
thorn nexus
#

@fallen kindle try path('notify/<int:question_id>/vote/', views.vote, name='vote')

fallen kindle
opal vale
#

What http status code should I raise, when my API is dependent on external api and external api does not answer?

ivory bolt
#

500

tough tartan
#

this is how i run my website:

app.run(host='192.168.2.188', port=5000)
```because it's like this, subdomains do not work
how do i fix this?
vague mango
dusk portal
dusk portal
late gale
#

Mind if i ask is it better to use Lets encrypt or use ssl provided by web hosts , I host my website on pythonanywhere and it has free SSL or I should encrypt it by lets encrypt

worthy lake
#

If they take care of all of that, then it should be just as good as lets-encrypt. Just verify by trying to connect to your website at port 80.

worthy lake
late gale
#

?

worthy lake
#

so it would be website.com:80 but that shouldnt be necessary. just do http:// and test that you cant load this without it switching to https.

#

If it does that, then it works

#

Either way

late gale
#

oh it did switch to https

worthy lake
#

if the say they provide SSL, they most likely do.

late gale
#

yes they provide a free one

#

so let's encrypt is useless if my website works fine with SSL of the web host

worthy lake
#

right.

late gale
#

cool thanks

gritty cloud
#

guys i need help with foreignkeys in django

#

so i want to send a foreignkey in a form

#
<form>
   <!--Form stuff-->
  <button type='submit'>Submit</button>
</form>
#

but i want to add a foreignkey

#

in the form stuff area

#

so how would i do that

native tide
#

Oops

#

Lol

weary bough
#

can someone help with django?

wary sequoia
#

does anyone know how to implement PGP 2fa?

#

in django

fair marsh
dense slate
#

Would love some help in #help-lollipop regarding some auth issue sending me an anonymous user back utilizing JWT!

past cipher
#

Am I right in thinking that Flask session data can not be viewed, unless the malicious user know the app secret key?

thorn igloo
astral pagoda
#

hi I asked a question yesterday in the help channel and didn't get any help. Can someone help?

My file tree looks like this

https://imgur.com/a/DB02hHb
init.py
init.py from the flaskapp folder
https://paste.pythondiscord.com/ezikihoyig.pyfrom
These 2 lines are not working from the above file and I don't know why
flask_sqlalchemy import SQLAlchemy
from flaskapp.users import users

config.py
https://paste.pythondiscord.com/zugemorazi.properties

init.py

init.py in the users folder

https://paste.pythondiscord.com/icopohadum.kotlin

forms.py
https://paste.pythondiscord.com/lurozitine.py
routes.y
https://paste.pythondiscord.com/tisagafaju.rb
models.py

https://paste.pythondiscord.com/utusinuder.py
The error here is
from flaskblog.users import db

#

If you don't want to go through all the files just look at the errors

astral pagoda
#

The question involves flask

inland oak
#

Can I order VPS from one provider, and DNS + certificates from another one?

#

there should not be anything against it?

#

oh nvm, I can

#

just checked to be sure

inland oak
#

Can anyone advice good resource to read about DNS?

#

I need to fill this blank in my knowledge (or lack of it)

inland oak
#

oh yes, there are books for that from O'Reilly. I wonder if there is something a little bit shorter to read though

#

preferably interactive

graceful flax
#

what is HTTP code that y'all use in login to check if email doesn't exist?

200 with exists - true/false in response
401?
404?
500?

topaz pumice
#

400 sounds pretty good

nimble epoch
topaz pumice
#

200 should only be for good requests, and 500 should only be if the server screws something up more or less

graceful flax
topaz pumice
#

if it's for login then my interpretation is that the request is bad since the server got bad information

#

It's like a 404: the search query was correct and the request is well formed, but nothing could be found, so an error occurred

candid yew
#

Hello

#

This happends everytime I enter a new div or item into my container

#

I'm using grid.

#

my code

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Website</title>
    <link rel="preconnect" href="https://fonts.gstatic.com" />
    <link
      href="https://fonts.googleapis.com/css2?family=Josefin+Sans:ital@1&display=swap"
      rel="stylesheet"
    />
    <link rel="stylesheet" href="styles.css" />
  </head>
  <body>
    <div class="container">
      <div class="name">
        <a href="#">Logo</a>
      </div>
      <div class="box one active">
        <a href="#">Home</a>
      </div>
      <div class="box two">
        <a href="#">About</a>
      </div>
      <div class="box three">
        <a href="#">Shop</a>
      </div>
      <div class="box four">
        <a href="#">Info</a>
      </div>
      <div class="logos">
        <i class="fa fa-twitter"></i>
      </div>
    </div>
  </body>
</html>

#

Everything moves upwards when I add a new div.

#

Not just a div. If I add any new icons or text.

#

why does this happen?

paper pier
mint folio
dusk portal
#

how can i add sign up page in my flask app

#

ik to make login panel and other stuffs by flask

dapper quiver
#

!rule 1

lavish prismBOT
gritty cloud
steady totem
#

hey could anyone help me with making an event listener that updates a buttons position upon scrolling?

mint folio
#

You should get the currently logged in user through your server side code.

gritty cloud
#

and how would i attach that to the form data

#

and save it

native tide
#

heh

modest scaffold
#

i've messed up my database for django

mint folio
native tide
#

seekaona

gritty cloud
native tide
#

aisa hai kya

#

how link html with python

#

??

thorn igloo
dusk portal
#

@thorn igloo oh

#

But how

#

Till now have made a class for them

#

@thorn igloo i want ur 5-10 mins when u free ping me will ask all questions of that and u can guide me within that time

#

Out of home rn
Will brb soon

dusk portal
#

Sure but I'm out rn
Out of home lol not on pc

#

Buying some groceries

#

@thorn igloo add me as friend bruh

thorn igloo
#

done

thorn igloo
dusk portal
#

Done

#

Yeah

dusk portal
#

@thorn igloo I'm back

proud lintel
#

Hi, How can I develop a graphql api with django and neo4j?

inland oak
#

Can someone recommend Domain provider?

calm plume
#

I've used Namecheap before, they're good

modest scaffold
#

someone please help me fix my db in django

#

its so messed up and i dont want to restart my project

jade lark
jade lark
modest scaffold
#

i created a custom user model mid way through the project

#

big mistake

#

i deleted the db and all migrations cause i thought that would just reset everything and would function normally afterwards

inland oak
#

plus he had broken web interface anyway

jade lark
modest scaffold
#

well it just doesnt work

#

i run migrate but it doesnt pick up any models or anything

inland oak
#

Wow.

#

namecheap has SSL certificates ten times cheaper than my local provider

#

I was definitely reaped off

jade lark
jade lark
#

Also side note, SSL certificates are free to get

inland oak
#

they look nice for testing period

jade lark
#

Yeah I like Hetzner they are really cheap and consistent. Only downside is that the german feds require you to bulletproof your server or they will take it down.

inland oak
jade lark
#

It's a real certificate.

inland oak
#

wow

jade lark
#

I use it for all my websites and clients.

inland oak
#

that's nice

inland oak
#

some limitations?

jade lark
#

None

#

You just need to have everything setup with Nginx on your server.

inland oak
#

shrugs I thought to setup with Nginx anyway

#

I thought to make redirect with Nginx tomorrow)

inland oak
# jade lark None

what protects me from other people taking my domain name for themselves?

jade lark
#

Uhh, you own it?

inland oak
#

oh, yes right

#

I forgot that it is only certificate

#

nvm)

jade lark
#

Think of it like renting it. Once you rent it for however long nobody else can rent it for that time

inland oak
#

I'll get domain name from namecheap then

late gale
#

namecheap is the best

#

I recommend that

inland oak
#

and will try to get certs from cert bot, or perhaps from namecheap too

late gale
#

it also has openwithGuard

inland oak
#

are they really fast expiring?

late gale
inland oak
jade lark
#

They always expire after a few months. A certificate needs to be renewed. Thankfully, certbot will autorenew the cert for you

late gale
#

oh no , dont know in linux

#

but i have a video that might help made by corey he's so good

late gale
#

and he also he bought a domain from namecheap

#

so give it a watch so u can understand everything

#

let me paste the link

#

In this Python Django Tutorial, we will be learning how to deploy our application to a Linux Server from scratch using Linode.

If you would like $20 of free credit towards a Linode account, then you can use my link here to sign up:
https://linode.com/coreyschafer

We will be covering the entire deployment of a Django application. This includes...

▶ Play video
#

In this Python Django Tutorial, we will be learning how to set up a custom domain name for our application. We will use NameCheap as our domain registrar and Linode to host our server. Let's get started...

If you would like $20 of free credit towards a Linode account, then you can use my link here to sign up:
https://linode.com/coreyschafer

B...

▶ Play video
late gale
inland oak
#

I hate videos

#

99% of water for 1% percent of useful information

#

without ability to skip water
I am a guy of text (+ pictures) tutorials and books

#

thanks anyway.

jade lark
#

I highly recommend his videos Darkwind

#

Corey Schafer makes great content

late gale
#

I told him that

modest scaffold
#

ive deleted all migrations and it still broky

late gale
#

Corey Schafer is one of the best

jade lark
#

I don't know if they include certbot for that though

late gale
#

Corey Schafer added a video for certbot and lets encrypt

inland oak
#

I already have Django with postgres and Gunicorn, packed into docker
I already even used Nginx, but I am going to make it into docker-compose for happiness

jade lark
#

if that doesn't work then did you use abstractuserbase or what class did you inherit from for the custom user model?

late gale
#

mind if u tell more about nginx like is it like pythonanywhere or heroku cause i dont know it very well

modest scaffold
#

i inherited from abstractuser

jade lark
#

OOooOo. If you're using docker I am not going to be helpful

late gale
#

@modest scaffold try to clean ur migrations files Dont delete the inital file and try to migrate again

inland oak
modest scaffold
jade lark
#

Not if you created a custom user model halfway through 🤦‍♂️

modest scaffold
#

i deleted all of em

late gale
#

oh dear

#

Nuke ur project

#

lol

#

is there any error

#

or something

jade lark
#

Do what I said Amaz

modest scaffold
#

k

jade lark
#

Then after run the migrate command

inland oak
#

and namecheap helped a lot
every bit helps)

modest scaffold
#

oh i think its working

jade lark
#

Keep going

#

do it for all apps

modest scaffold
#

ok now do i run migrate

jade lark
#

Yes

late gale
#

hope it works

modest scaffold
#

i think its working now

late gale
#

awesome

modest scaffold
#

thanks you so much magic

late gale
#

oh btw mind if i ask what's the importance of gunicorn

modest scaffold
#

👍

jade lark
#

No worries dude happy to help.

late gale
#

I just read an article that it says to use gunicorn to improve ur website performance

modest scaffold
#

i think gunicorn puts your project on an actual server

late gale
#

and is serving ur static files on AWS3 also helps ?

jade lark
modest scaffold
#

rather than the test server

late gale
#

oh even for deployment ?

modest scaffold
jade lark
late gale
#

mind if i ask how to use gunicorn , i installed it now what

jade lark
late gale
modest scaffold
#

i think generally serving static files from a dedicated server is better

jade lark
late gale
#

what's the most recommend web host , i find pythonanywhere some features are still not occured like 1i8n

#

is digital ocean good ?

#

didnt use it before

modest scaffold
#

heroku isnt too bad to setup

#

and they offer free hosting

jade lark
#

DigitalOcean, AWS, Linode, Vultr are all pretty good.

#

Heroku and PythonAnywhere are PaaS

late gale
#

25$ per month

jade lark
late gale
#

so digital ocean is better than pythonanywhere and heroku ?

jade lark
#

It depends.

late gale
#

on what?

jade lark
#

What you value, the project requirements, and probably your funds

late gale
#

I need something better security , rapide performance and less price cause its an eCommerce website

#

and ofc easily to handle

jade lark
#

Did you code the eCommerce site? And assuming it's a Python backend?

late gale
#

yes why

#

using django

jade lark
#

Will it actually be used by other people

late gale
#

ofc just building a website for a non profit organization that later a team will control it