#web-development

2 messages ยท Page 203 of 1

dusty steeple
#

yeah... it's just my excuse.
I doubt I'd ever be good at SOE or the business side of things, and my design is pretty meh, but that's why the collaborative approach works so well.

It's daunting but the bits that one can do will get results or can be measured.

vernal iron
#

SOE?

dusty steeple
#

My brain is so full at the moment.
Ah, Search Optimization ... something. ?

vernal iron
#

oh

#

search engine optimization

dusty steeple
#

oh, yes.

#

(making my mark, one fumble at a time)

vernal iron
#

@dusty steeple turns out this does work, I just had omitted some code when I tried to merge both the regular single object resolver approach and the relay approach.

dusty steeple
latent wagon
#

What is the difference between using Quart and Uvicorn?

#

or just which library should you use for ASGI web server

manic frost
#

So

[application framework]          [HTTP server]
FastAPI  ---                    uvicorn
             \               /
Starlette ----+-------------+-- hypercorn
             /               \ 
Quart ------/                   ????
jade lark
#

I'll tell myself that next time I launch a startup thinkmon

rich sage
#

Hey guys, I'm using allauth for user register and login, is there any way to add user into certain user group when account has signed up without create a new customer user model?

snow quartz
#

how do you connect a google colab notebook to a web front end?

restive pine
#

please let me know how it goes. Its on my todo list and its coming up soon

restive pine
#

I'm using celery for the first time. Im adding it to a flask api deployed on kubernetes. Due to some issues that turned out to be minor (I never restarted the celery worker) I now have two working projects one with regular task and one with shared_task but not really sure whats the difference. I read this https://stackoverflow.com/questions/54506515/difference-between-different-ways-to-create-celery-task but still a little confused are there any disadvantages to shared_task over regular task other then having to turn your task into its own library?

inland oak
#

Providing the code in screenshots is not the best way, better copy it as text
Otherwise it is hard to give u help

inland oak
pure bridge
#

What I need to know to make websites? Ping me

stark tartan
pure bridge
#

Whats that?

lime valve
#

can i do it with more languages?

#
const x = document.querySelector("p");
const func() => {
  x.innerText = "wow";
};
#
h1{
  background-color: #fff;
  /*WOW im impresed*/
}
inland oak
# pure bridge What I need to know to make websites? Ping me

U need to choose if u wish making website with CMS, Wordpress / or https://tilda.cc/ for example.
That will require mostly Design skills + A small bit of advanced user skills
Should be pretty fast to make, but limited to... certain boilerplates.
To start doing that: start using Tilda or find a book for Wordpress, those are actually almost no code solutions.

or if u wish being fully coding developer
Then u need to learn Frontend / Backend
HTML / CSS / JS / backend language / Docker and e.t.c.
high customization, longer training.
Where to start a bit difficult to say, depends on what u wish to make.
If u wish high client side interactivity and nice viewable part, then start from Frontend
if it is important for you to have some server side work / having database for your web site, then start from Backend

inland oak
#

if u work with Python / Backend langs, u a limited to use only this and Jinja 2

#

Actually no, U can also attach JQuery

#

it should bring a lot of flexibility while still remaining in backend framework ๐Ÿค”

#

but regardless, it is still outdated way to approach it

#

people use Frontend Framework for this

#

React / Angular / Vue.js or even Svelte

#

they replace Vanila JS operations with much simpler and richer their own syntax

Actually u know... it is even possible to insert frontend frameworks directly to backend ๐Ÿค”
Although what would be the point? Better having them separated i think

modest hazel
#

Hey fellas i'm wondering how to run aiohttp or fastapi or flask inside asyncio.gather

#

I want to run my server and playwright in the same process, so they can share a Q

ocean slate
#

Any solution?

thorn igloo
ocean slate
#

Yes

#

Pip install Flask-login

#

See i used show command and its showing that is is installed

#

Had stuck from morning

#

๐Ÿ˜ซ

inland oak
#

nobody can help you with screenshots of a code we can't see

snow quartz
#

@restive pinety I'll have a look

thorn igloo
# ocean slate

to me, what makes sense is that you're probably using some sort of environment to run the app, seeing as you're using pycharm, and this environment doesn't have the library installed. just my guess

karmic star
#

Any idea how to move forward with an api endpoint which only admin can access and when he hit that api, all the other apis stop (i.e. they don't accept anymore request unless it's turned on from the same admin api again)

#

My approach is, I will maintain a table to store api status (ON or OFF) and then write an admin api to set that status. After that write a decorator function which check for the status and if status is OFF I will abort the request with 503 status and custom message (like service will be available after half hour)

inland oak
# karmic star My approach is, I will maintain a table to store api status (ON or OFF) and then...

it sounds good enough.
except perhaps the part maintain a table ? that sounds like an extreme way to approach it.
having requests to SQL database just to check application status is a bit too much and slow way to approach it. And maintaing a special table for this.

how about for admin url to set the state in OS environment, if it is in one server? as fastest no database solution to work across all workers, or even just plainly simple in file.
or at least in Redis NoSQL db if it is across multiple servers.

karmic star
#

the problem is admin api and user api are running in different containers and using their respective Redis instance for the same like DB0 is for user related apis, and DB1 for admin related apis. Only thing shared among them is the common database for both

inland oak
#

but I guess u should use database then in order to keep your application stateless

#

the sql database is located in different server right?

#

or to raise small shared redis

#

or for admin container to access user container redis

#

hmmm... it sounds like it should be handled differently

#

for some reason I wish to approach this issue at level of Reverse Proxies / Floating IPs

fast remnant
#

Hi

karmic star
karmic star
karmic star
inland oak
# karmic star yes

admin and user application is completely different applications, or the same applications with different env?

#

anyway, docker-compose allows to access other containers objects with url like https://container_name/blabla

#

perhaps in admin application to connect to user container redis://user_container_docker-compose_name/ and making the change state

karmic star
#

two different application with shared sql database, they both have different portal too on frontend

rotund perch
#

Hello, I have a signals.py file in my account folder, I did a Profile model with a one-to-one relation with the django built-in User model. However, it doesnt create a profile. Does it need any additional configurations?

signals.py

from django.db.models.signals import post_save
from django.contrib.auth.models import User
from django.dispatch import receiver
from . import models

@receiver(post_save, sender=User)
def create_profile(sender, instance, created, **kwargs):
    if created:
        models.Profile.objects.create(User=instance)

@receiver(post_save, sender=User)
def save_profile(sender, instance, **kwargs):
    instance.profile.save()

models.py

from django.contrib.auth.models import User
from django.db import models
from django.db.models.fields.related import OneToOneField

# Create your models here.
class Profile(models.Model):
    username = OneToOneField(User, on_delete=models.CASCADE)
    description = models.TextField()
    image = models.ImageField(upload_to="images")
modest hazel
#

Hey fellas i'm wondering how to run aiohttp or fastapi or flask inside asyncio.gather
I want to run my server and playwright in the same process, so they can share a Q

rotund perch
karmic star
#

username = models.OneToOneField
try this, don't import onetoonefield

rotund perch
# karmic star username = models.OneToOneField try this, don't import onetoonefield

It worked Like this.

from django.contrib.auth.models import User
from django.db import models
from django.db.models.fields.related import OneToOneField
from django.db.models.signals import post_save
from django.dispatch import receiver

# Create your models here.
class Profile(models.Model):
    username = OneToOneField(User, on_delete=models.CASCADE)
    description = models.TextField()
    image = models.ImageField(upload_to="images")


def create_profile(sender, instance, created, **kwargs):
    if created:
        Profile.objects.create(username=instance)

post_save.connect(create_profile, sender=User)

def save_profile(sender, instance, created, **kwargs):
    if created == False:
        instance.profile.save()

post_save.connect(save_profile, sender=User)
sacred crane
#

hey i have build a restapi using flask now i want to scale that api and handle queing. can any one suggest how to do it?

rotund perch
#
def userProfile(request):
    realProfile = models.Profile.objects.get(username=request.user)
    form = forms.ProfileForm()
    if request.method == "POST":
        form = forms.ProfileForm(request.POST, request.FILES)
        if form.is_valid():
            if(realProfile == request.user.user_profile):
                profile = models.Profile(
                    image=request.FILES['image'],
                    description=request.POST['description']
                )
                profile.save()

ERROR:UNIQUE constraint failed: UserAccount_profile.username_id

def userProfile(request):
    realProfile = models.Profile.objects.get(username=request.user)
    form = forms.ProfileForm()
    if request.method == "POST":
        form = forms.ProfileForm(request.POST, request.FILES)
        if form.is_valid():
            if(realProfile == request.user.user_profile):
                profile = models.Profile(
                    username=request.user.id,
                    image=request.FILES['image'],
                    description=request.POST['description']
                )
                profile.save()

ERROR:Cannot assign "7": "Profile.username" must be a "User" instance.

it gives me an error if I didnt send a user id with the Profile model fields, and it gives me an error if I assigned the user id to the Profile model username field.....

modest hazel
#

Hey fellas i'm wondering how to run aiohttp or fastapi or flask inside asyncio.gather
I want to run my server and playwright in the same process, so they can share a Q

native tide
#

how do I make selenium to click on a span button?

craggy tapir
#

u cud essentially find the xpath of that button and then use driver.find_element_by_xpath and then if that object is stored as btn then use btn.click() i think

native tide
#

i know to make it to click on a normal button but after using element check it was <span class

craggy tapir
#

im sorry but i dont understand the difference bw clicking a span element and anything else, i suppose u can do it in the same way we do so with other elements? use css selector or xpath am i correct?

craggy tapir
#

glad i cud help

native tide
#

soo i am trying to search something in search box and it doesnt have any buttons is it possible to press "enter" in selenium

craggy tapir
#

u can use .send_keys()

#

so i found this

from selenium.webdriver.common.keys import Keys
driver.find_element_by_name("Value").send_keys(Keys.RETURN)```
from stackoverflow let's use this as an example
inland oak
rotund perch
#

btw it is solved this way

def userProfile(request):
    realProfile = models.Profile.objects.get(username=request.user)
    print(realProfile)
    form = forms.ProfileForm()
    if request.method == "POST":
        form = forms.ProfileForm(request.POST, request.FILES)
        if form.is_valid():
            if(realProfile == request.user.user_profile):
                realProfile.image = request.FILES['image']
                realProfile.description=request.POST['description'] 
                realProfile.save()
pallid lily
#

Django : what is the difference between using class based views and function based views?

#

is there some thing extra?

inland oak
# rotund perch u mean I put the if statements ordered but not nested?
def userProfile(request):
    realProfile = models.Profile.objects.get(username=request.user)
    print(realProfile)
    form = forms.ProfileForm()
    
    if not request.method == "POST":
        return response({"error": "wrong TYPE request", 400)
    
    form = forms.ProfileForm(request.POST, request.FILES)

    if not form.is_valid():
        return response({"error": "invalid form", 400)

     if not (realProfile == request.user.user_profile):
        return response({"error": "Wrong profile", 400)

    realProfile.image = request.FILES['image']
    realProfile.description=request.POST['description'] 
    realProfile.save()
    return response({"result": "yay", 200)
#

something like this

rotund perch
inland oak
#

that makes your happy path linear at the left. u a welcome

slim urchin
#

why is this happening

dense slate
#

so you need func_1() in the innerHTML to return the result of the function

dense slate
dense slate
inland oak
# dense slate How is your Vue learning coming along?

nicely. last two weeks actively used at work.
surprised the boss with so quick learning.

Learned CSS/SASS/ positioning with Flexboxes / Grids / Absolute-relative positioning
Learned how to setup Vue project with all stuff / babel and e.t.c.
Learned how to use Components & Vuex ( state management ) / Router / I8n
Last two days started actively using Jest to unit test stuff

#

I would say, I learned enough to complete small projects ๐Ÿ˜‰

dense slate
#

I need to buckle down and get some Jest testing training.

#

Any good online sources? Don't tell me you got another book for it. ๐Ÿ˜‰

inland oak
#

Uh. I just started to use from scratch

#

in unit testing i ve read only generic book for how testing is done

dense slate
#

Ah

inland oak
#

essentially I already knew how to test with big experience in backend / pytest

#

just googled Jest syntax, and how to test in Vue.js (there is added some Vue library for jest testing of components in addition)

inland oak
#

probably should read more of documentation perhaps

#

I just learned for now how to test backendish frontend part, the most necessary part for me
later will try component testing, i have one example for that though

inland oak
# dense slate Ah

I can recommend the book for generic understanding of testing btw if u wish)

inland oak
#

I wonder how long time it will take to get a middle level hang of it ๐Ÿค”

#

guys say around half of year

#

i hope to learn it faster

dense slate
inland oak
# dense slate How do you plan to use them?

mostly I wish for self recovering servers
plus to balance load with different amount of servers in different day hours automatically
plus probably for zero down time deployment too

inland oak
#

well, basically minimal goal is to learn every possible application

#

Oh, remembered

#

I actually want it also in order so I could deploy/remove new servers on a run in load balanced group with easier networking situation

#

wait, I can probably do it without kubernetes

#

just a matter of having load balancer with health check, which are available in cloud providers

#

nvm then, this goal is already fulfilled without k8s

#

but still interested to learn networking solutions that make life easier in heavy microserviced situation

#

smth for Service Mesh stuff, there smth should be existing at k8s level

inland oak
#

I am fascinating with automating everything ;b

#

saves time, faster development / faster deployments

#

makes possible what is impossible in short time

#

that's mostly about CI CD though, but all other tools are just part of it to write the infrastructure as a code

dense slate
#

Ah I see, sounds like a good skill to have.

#

Similar to Docker or a different tool altogether?

inland oak
#

basically Docker at a more global higher level, a tool to control myriad of containers, to scale those containers across multiple servers

native tide
#

Darkwind, good luck with k8s :)

#

just know that baremetal k8s vs managed k8s is not the same

inland oak
#

I already use Docker /Ansible / Terraform / Gitlab CI

#

with terraform going to spin up managed K8s in Digital Ocean, i see no point to deal with baremetal k8s, except for trying to learn initially in minikube.

inland oak
dense slate
#

Sign me up for more full snack dev. ๐ŸŒญ

drifting umbra
#

Hey peeps, need some help, can y'all suggest some cool APIs to work with, for js practice mainly
P.S Not python, only javascript (html css is okay)

inland oak
#

what do u mean by APIs, what u wish to achieve

#

anyway, Node.js backend framework sounds like a fine thing to create REST API

drifting umbra
inland oak
drifting umbra
#

eg. discord api helps build bots with python, something like that

inland oak
#

still not clear what u wish
finding a framework to build stuff out of the box, or exactly API to use party services

#

anyway, if u wish really API, then I can suggest nothing. There are too many of them

#

just think of what API u wish / google / it should be there for any kind of service

#

but since they are almost all SaaS usually.... not really useful.
Although world wide messangers offer them for free indeed. Discord / Telegram and e.t.c.

#

perhaps to google something like Best Free APIs

drifting umbra
native tide
#

I have a date time field in a model in django, I want to filter all of the model instances that are less than or equal to the current time, how do I do this

inland oak
#

so... all you need is for getting now

from datetime import datetime
now = datetime.utcnow()
native tide
#

but how would I compare them

inland oak
#

and as long as you solve UTC problems, u should able to handle it

inland oak
#

apperently overloaded operators > work fine when they are both datetime types

native tide
#

is there any way to do it when I filter all the model instances

#

so for example I am getting all the events through this command

#

userEvents=Events.objects.filter(user=pk)

#

can I do something like userEvents=Events.objects.filter(user=pk, date<datetime.utcnow())

inland oak
#
>>> Entry.objects.filter(
...     headline__startswith='What'
... ).exclude(
...     pub_date__gte=datetime.date.today()
... ).filter(
...     pub_date__gte=datetime.date(2005, 1, 30)
... )
#

official documentation for Django ORM has examples for datetime queries

#

date__get=some your date should make comparison < apperently

#

__lte is synonim for >

native tide
#

yes I understand

inland oak
#
> q = q.filter(pub_date__lte=datetime.date.today())
marble oak
#

Can someone tell me how i can keep my discord bot up with a html?

rugged tendon
#

hey this is probably a stupid question, however im about to order a domain ive come up with a name but im not sure if there rules against certain domain names?

frank shoal
frank shoal
#

basically alphanumeric plus - and _, no spaces, lowercase.

#

There's some legacy limitations like needing to be < 64 characters

heavy ferry
#

does anyone know how to make a search bar in django that passes the string in the search bar into the view?

inland oak
heavy ferry
#

yes

inland oak
#

Search bar as in regular text field?

heavy ferry
#

so like i have a weather api and i want to pass the city name to the view so it can do an api request and pass that context to the render

#

yes

inland oak
#

Just a regular html form then

#

Input form with text field

#

And action to do post request on pressed form submit button

heavy ferry
#
def index(request):
    """Returns render of index.html template to http request"""
    # get city name from request?
    wp = WeatherPacket(cityname)
    
    return render(request, 'weather/index.html')
#

cause from my understanding you pass the context for the render

#

but how do i access the information from the post request in the view?

#
<div class="main-content">
        <div class="search-form">
            <form method="POST">
                <div class="search-bar-container">
                    <input class="search-bar" type="text" placeholder="search a city...">
                </div>
                <div class="search-button-container">
                    <button class="search-button">search</button>
                </div>
            </form>
        </div>
    </div>
inland oak
heavy ferry
#

ohhhhhh

inland oak
#

If get, regular render

#

If post, handle recieved data from form and return new render

heavy ferry
#

oh the request.method

#
 if request.method == 'POST':
        form = UserRegistrationForm(request.POST)
        if form.is_valid():
            # save the form to db
            form.save()
            username = form.cleaned_data.get('username')
            messages.success(request, f"Your account has been created, you can now login!")
            return redirect('login')
#

i used this in a tutorial

inland oak
#

Yup, probably that is

heavy ferry
#

i think this is the same concept

#

but im not posting anything to a db?

#

post can mean just posting data to the server as context too?

compact fjord
#

Hello, can someone help me how to write a proper procfile for heroku, (after several fail attempts)
my github repo is like

flask_notes:
Website:
init
templates
main.py

#

app = create_app()

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

and I am getting error as

at=error code=H14 desc="No web processes running" method=GET path="/" host=easydoesit.herokuapp.com request_id=2139c3c5-44ed-475a-ac96-d4481c6678df fwd="117.213.169.158" dyno= connect= service= status=503 bytes= protocol=https```
tired kraken
#

Hi there, anyone familiar with setting up project in Django, Docker and Postgresql? Would appreciate help with pathing please. Getting some errors which I cannot catch on.

orchid olive
#

what is the best way to clean tags from a stringfield using wtforms?

vernal thistle
#

Need some help with Flask. Is there a way to redirect unauthenticated users to the login page automatically, without changing every view function? Currently I am doing a simpleif statement at the top of each route/view function:

if not current_user.is_authenticated:
  return redirect(url_for('login'))

This works fine. If users tries to manually enter a url without logging in, they are redirected to login, but I need to change every function. Is there a better cleaner way?

odd locust
#

Hey folks. What system do people use to deploy their flask apps these days? Is mod_wsgi + <VirtualHost> configs still used? or is there something better now?
I am having the worst luck deploying this flask app to my CentOS 7-based VPS.

#

Related: Does anyone know how to uninstall python 3.9.7 from CentOS 7 when it was installed from source? I haven't found any articles for this particular version of python, and the MAKE file has no 'uninstall' section.

inland oak
odd locust
#

Most resources say to rm a bunch of specific paths.
Does anyone know how to find out the specific paths that a python version might have been installed to? Perhaps hidden in the MAKE file?

native tide
#

Hello. who has a code for tic tac toe?

native tide
#

Hello. who has a code for tic tac toe?

The code pls

odd locust
#

"tic tac toe source code python"

#

see what you find

#

are these folders what I remove when manually uninstalling python3.9 which was installed from source?

[Python-3.9.7]# whereis python3
python3: /usr/local/bin/python3.9-config /usr/local/bin/python3.9 /usr/local/lib/python3.9
azure umbra
#

can you recommend some cheap vps?

manic crane
#

i deleted my django_admin table in my DB because of an error im trying to run python3 manage.py migrate admin to make a new one and it says no migrations to apply so i keep getting this error => ProgrammingError at /admin/
relation "django_admin_log" does not exist

pallid lily
#

go to your application

#

delete all migration files

#

delete from 0001_initial

#

and what comes after

#

and delete your SQLite database

#

befor making migrations

spiral blaze
#

is javascript for making animations?

native tide
#

so I'm working on a little website project, and was working on the login portion, and was using quart for this, and was playing around with forms to see how they work.
this is the the html code for login.html:

<html>
<script>
    function submitForm() {
        document.getElementById('Login').submit()
    }
</script>
<form id="Login" action="/sus_login" method="POST">
    <div id="email">
    <label for="email">Enter your email: </label>
    <input type="email" id="email" namerequired>
    </div>
    <div id="password">
    <label for="email">Enter your password: </label>
    <input type="password" id="password" required>
    </div>
</form>
<button onclick=submitForm()>Submit</button>

</html>

app.py:

import asyncio
from logging import exception
import re
from quart import Quart, request
import quart
from quart.helpers import url_for
from quart.templating import render_template
from quart.utils import redirect
import quart_auth   # type: ignore
import json
import argon2
import asyncpg
import toml

config = toml.load('config.toml')
loop = asyncio.get_event_loop()
pool = loop.run_until_complete(
    asyncpg.create_pool(
        f"postgres://postgres:{config['postgres']['password']}@localhost:5432/spot_a_fly",
        loop=loop,
    )
)
app = Quart(
    __name__, template_folder='templates'
)
app.secret_key = __import__('secrets').token_urlsafe(16)
quart_auth.AuthManager(app)

@app.route('/login')
async def login():
    return await render_template('login.html')
@app.route("/sus_login", methods=["POST"])
async def sus_login():
    print(await request.form)
    return (await request.form)

However, request.form is always an empty dict. why?

inland oak
inland oak
#

javascript is only third in the queue, when all means to do it in other ways were exhausted.

#

Or actually they could be used in pair

#

animation in CSS, triggered by javascript often

#

in javascript we have Canvas for custom stuff

snow quartz
inland oak
#

there is an exception where javascript is quite nicely used as animation easily

#

but it happens if u use javascript from the frontend framework

#

So I would think of CSS or how to use frontendish/frameworkish js for animation first
๐Ÿค” probably there are more ways to apply animations through javascript. The question is only in which ones out of them the nice and easy ones

restive pine
snow quartz
restive pine
#

Like a python flask/dash/ stream lit or like a react/ js one thatโ€™s not on colab?

snow quartz
#

Right

#

Probably react, but it could be anything else if it's better

#

Idk if it's even possible to use colab that way

#

As the backend to a public app

#

Anvil has a tutorial using their tech, they do some kind of streaming callback

snow quartz
#

I want to run a notebook with different parameters and queue jobs because of usage restrictions

pseudo finch
#

While I run command 'django-admin runserver', I'm getting this error. I didn't understand what it says this error. Everything looks configured but still I'm getting this error.

dense slate
pseudo finch
dense slate
#

Yea, I would recreate it if you have a problem like that off the bat.

#

Clean project should work right out of the box.

manic crane
#

I accidentally deleted django_admin_log and now i can not use the django admin

dense slate
#

Ctrl-Z!

#

That's a joke - but if you're in VS Code, maybe you can delete the change in your commits window.

manic crane
#

I accidentally deleted django_admin_log and now i can not use the django admin , i get this error => relation "django_admin_log" does not exist
LINE 1: ..."."app_label", "django_content_type"."model" FROM "django_ad...

azure umbra
dense slate
indigo kettle
#

if you don't mind starting from an empty DB, I would just drop the database and recreate it and rerun migrations

#

if that's a big problem, then tell us what error you're getting

late gale
#

guys have a question in django when i delete an object say i deleted a user of id 2 when new user creates a new account it generated with id 3 not id 2 how to solve this

#

im using sqlite db

indigo kettle
#

why does it need to have id 2?

dense slate
#

It's just an ID so it shouldn't be a problem.

manic frost
#

or better yet, don't use sequential IDs at all

#

generate UUIDs instead

lime valve
#

ยด

spare ermine
#

anyone know how to return a post function without redirecting the client using flask?

thorn igloo
#

you want to post without causing a reload in the front end?

#

am i reading that right?

spare ermine
#

I have basic incomplete function: ```py
@app.route('/', methods=['GET', 'POST'])
def home():
if request.method == 'POST':
gameCode = request.form['pin']
name = request.form['name']

  p = player.Player(name)

  found = False
  for game in games:
    if game.game_code is gameCode:
      game.addPlayer(p)
      print("found game")
      found = True

  # HERE
  if not found:
    flash("Could not locate a game with that pin.")
    print("couldnt find game")
    return redirect(request.url)

return render_template("join.html", user=current_user)
the part where I marked `# HERE`. The return redirect(request.url) is needed for the code to work, although i dont want it, I want it to post the error and then just abort everything
thorn igloo
spare ermine
#

well, it says at that point, a game with that pin doesnt exist, so try again, and then stops. But when it stops it redirects, I want something like Kahoot. When you enter the gamecode and it is incorrect, it doesnt redirect, it just flashes "A game with that pin doesnt exist"

spare ermine
#

sort of

#

yeah

thorn igloo
#

ok, why not use flask_wtf to handle that for you

spare ermine
#

the user enters a pin number, if it matches a game, then connect them to it

thorn igloo
#

you can set it to reload the same page with errors

spare ermine
#

I dont want the website to physically reload

thorn igloo
#

ok, then use ajax calls

spare ermine
#

alright

#

thanks

thorn igloo
#

but your endpoint will have to look like an api

dusty steeple
copper lagoon
#

how do i add ratelimits to quart/flask ping me pls

inland oak
wind abyss
#

I have a question on the virtual environment for Django

wooden ruin
native tide
#

so I'm working on a little website project, and was working on the login portion, and was using quart for this, and was playing around with forms to see how they work.
this is the the html code for login.html:

<html>
<script>
    function submitForm() {
        document.getElementById('Login').submit()
    }
</script>
<form id="Login" action="/sus_login" method="POST">
    <div id="email">
    <label for="email">Enter your email: </label>
    <input type="email" id="email" namerequired>
    </div>
    <div id="password">
    <label for="email">Enter your password: </label>
    <input type="password" id="password" required>
    </div>
</form>
<button onclick=submitForm()>Submit</button>

</html>

app.py:

import asyncio
from logging import exception
import re
from quart import Quart, request
import quart
from quart.helpers import url_for
from quart.templating import render_template
from quart.utils import redirect
import quart_auth   # type: ignore
import json
import argon2
import asyncpg
import toml

config = toml.load('config.toml')
loop = asyncio.get_event_loop()
pool = loop.run_until_complete(
    asyncpg.create_pool(
        f"postgres://postgres:{config['postgres']['password']}@localhost:5432/spot_a_fly",
        loop=loop,
    )
)
app = Quart(
    __name__, template_folder='templates'
)
app.secret_key = __import__('secrets').token_urlsafe(16)
quart_auth.AuthManager(app)

@app.route('/login')
async def login():
    return await render_template('login.html')
@app.route("/sus_login", methods=["POST"])
async def sus_login():
    print(await request.form)
    return (await request.form)

However, request.form is always an empty dict. why?

dusty steeple
#

I'm not sure how html scripts and quart.request convert elements by ID to python dicts but that's where I'd look until someone who knows gives a better clue.

... I didn't really focus on web dev at college, but isn't an #id meant to be unique in html?

crisp dragon
#

i have little blog project in django which i have deployed on heroku. and i'm using ckditors RichTextUploadingField in production but when i set debug=false ckeditor shows red x on image preview. can anyone help me with that

manic crane
native tide
#

Hey i have a question what is a domain? Like how its made and is it possible for us to make? Is it possible to use heroku to host my domaind which i created? Is coding required for it?

#

illuminati song intensifiers

native tide
#

Anyone?

copper lagoon
karmic star
#

How can I deny request with some error message, while the server is still running for maintenance? Clients get 503 when server is not running, I want to imitate the same while the server is still up during the maintanence, so that client get 503.

#

i.e. any request for any endpoint get redirected to error message of maintenance

steady hatch
#

web

golden bone
native tide
#

hey which will be good smtp provider

native tide
#

hi all, how I could make a Quiz App for Coders?

#

I would like to make like simpler Hacerrank. In order for studetns to run Tests and get feedback.

ruby palm
#

Question: let's say someone wants to make an application that is gonna have a really LOT of users. This means quite a lot of work in the dev ops side, as you have to configure a lot of stuff, such as load balancers, HA databases, etc. Ignoring that, is it a priority to choose the fastest language for the framework the backend is gonna rely on..?

#

For example: Java faster than Python. Let's do it in Spring Boot and not in Flask.

inland oak
#

for example caching with web accelerating caching, intercepts requests before they reach framework

#

plus with using fast for development language, highly likely u will optimize its architecture just better to perform

ruby palm
#

Hello! Are you referring to my question by any chance?

ruby palm
#

Ohh, ok ok!

#

Thank you very much :))

inland oak
#

for some rason addressed wrong person

ruby palm
#

highly likely it will matter almost nothing. Because 99% of the framework time is spent in waitings
This is the fundamental click I needed!

#

web accelerating caching
What do you mean?

inland oak
ruby palm
#

Yes, ok

inland oak
#

in front of it u have Nginx web server setup as reverse proxy to your python server

ruby palm
#

Ok!

inland oak
#

u enabled in Nginx to cache /your_awesome_page and to keep it cached server-side for 5 minutes
First user requests page and receives it from python web server
all other users in the next five minutes, receive the copy of /your_awesome_page stored in nginx. Requests do not reach python server

#

(Same can be applied to python servers that work as REST API and return just JSONs)

#

The point of it...nginx will serve FASTER it

#

the page will be not rendered in python framework

ruby palm
#

Right, I understand!

inland oak
#

if it is rendering requires requests to SQL servers, repeated requests will be not made

ruby palm
#

By any chance, do you use Docker on a daily basis?

inland oak
#

for everything

ruby palm
#

Ohh, I have a quick question

#

Let's say I have an Angular application

#

I want it this way:

#

Container 1:
NGINX -> serves static files with the angular application in it

Container 2:
NGINX -> Gunicorn -> Flask. This is the API the container 1 makes requests to

#

Is that possible with docker?

inland oak
#

Sure.

ruby palm
#

Ohh, ok!

inland oak
#

I have almost same thing

#

Container 1:
Nginx serves built Vue.js app

FROM node:lts-alpine3.12 AS build

COPY package-lock.json package-lock.json
COPY package.json package.json

RUN npm install

COPY . .

RUN npm run build

FROM nginx:1.21.3-alpine-perl As runner
COPY --from=build dist/ /usr/share/nginx/html
#

something like that would be used

#

first container layer Node builds my vue into /build folder
second layer servers it with Nginx

#

Container 2...

#

a bit more complicated

inland oak
#

One container serves Python web server through Gunicorn

#

Second container contains Nginx that reverse proxies to this Gunicorn

#

Docker-compose allows easily to unite them together into one multi containerized structure

ruby palm
#

Ohhhh, ok!

#

Thank you very much :))

neon mortar
#

Hi there, i'm trying to connect to the discord rest API which is using a websockect connexion

#

Unfortunately, the heartbeat of my client seems to fail after a couple of days

#

This is the logs i end up with

#
2021-11-30 15:28:37 Waiting for new event.
2021-11-30 15:28:37 `message_create` middleware has been invoked
2021-11-30 15:28:37 `payload` middleware has been invoked
2021-11-30 15:29:42 < BINARY c2 db e4 32 c1 3b 67 36 b2 fa 1e c0 8a 1b 00 00 00 ff ff [19 bytes]
2021-11-30 15:29:42 < BINARY c2 1f 56 c3 e7 74 83 41 32 cc 6b 64 68 04 5a ec ... 03 4d 00 00 00 00 ff ff [29 bytes]
2021-11-30 15:29:42 < BINARY c2 9f 90 87 cf 32 fd 41 30 5c 6a 64 68 31 ba ad 98 26 89 18 00 00 00 ff ff [25 bytes]
2021-11-30 15:29:42 < BINARY c2 9f 88 29 98 74 a3 f1 d9 c3 a3 69 76 e4 a6 59 00 00 00 00 ff ff [22 bytes]
2021-11-30 15:29:42 < BINARY ec 5d 4b 0a c2 30 10 bd 4a 4e a0 4d a6 a9 2d ae ... 8d 97 e6 08 00 00 ff ff [265 bytes]
2021-11-30 15:29:42 < BINARY c2 5f de e0 98 17 47 ea cc 56 a4 16 64 40 ae 57 ... 02 03 00 00 00 00 ff ff [93 bytes]
2021-11-30 15:29:42 < BINARY c2 1f 40 14 ec 1d 18 d8 46 c4 20 e9 c1 19 03 d3 ... d0 92 00 00 00 00 ff ff [32 bytes]
2021-11-30 15:29:42 < BINARY c2 9f 70 71 cc 19 23 e5 ec 80 c4 92 a2 cc e4 6c ... 91 9b 01 00 00 00 ff ff [77 bytes]
2021-11-30 15:29:42 < BINARY c2 1f 28 14 dc 69 35 e2 bb 04 c6 86 e0 db 15 47 ... f5 73 32 00 00 00 ff ff [26 bytes]
2021-11-30 15:29:42 < BINARY c2 9f 68 f1 ed ad 30 36 30 34 07 e6 45 d0 d2 7e ... 1d f3 00 00 00 00 ff ff [31 bytes]
2021-11-30 15:29:42 < BINARY c2 bd 50 c9 14 cb 88 31 69 0b 95 40 d3 fc a3 0b ... 42 25 00 00 00 00 ff ff [27 bytes]
2021-11-30 15:29:42 < BINARY c2 9b 54 4d f1 ee 1f 18 c8 3b 63 01 00 00 00 ff ff [17 bytes]
2021-11-30 15:29:42 < BINARY c2 ef 6c 0a 86 3b 47 1b 79 c0 0c 6b 62 68 3c 3a ... 93 9a 01 00 00 00 ff ff [26 bytes]
2021-11-30 15:29:42 < BINARY c2 9f 6e f1 8d 70 0e dc fd 15 c4 0e d6 98 18 18 ... 2c 3b 02 00 00 00 ff ff [158 bytes]
2021-11-30 15:29:42 < BINARY c2 9f 9a 28 b8 9b 6a c4 37 8e 4d 0c 2d 41 67 21 ... 2f 01 01 00 00 00 ff ff [28 bytes]
2021-11-30 15:29:42 < BINARY c2 9f 66 07 e7 25 f5 44 97 80 a6 e6 86 e8 25 a0 ... ba 77 00 00 00 00 ff ff [46 bytes]
2021-11-30 15:29:42 < BINARY c4 5d 5d 0e 82 30 0c be 4a 0f a0 66 6b 61 83 03 ... 09 dc 9e 00 00 00 ff ff [213 bytes]
2021-11-30 15:29:42 < BINARY c2 9f fc 28 38 17 7b b4 5b 02 4c 1d a6 a0 a3 40 ... 51 2b 03 00 00 00 ff ff [28 bytes]
2021-11-30 15:29:42 < BINARY c2 9f 70 47 87 59 29 48 b4 46 e0 55 00 a3 89 96 fa 89 16 00 00 00 ff ff [24 bytes]
2021-11-30 15:29:42 < BINARY c2 9f 68 f1 0e b3 e2 3f 54 98 b6 63 57 00 00 00 00 ff ff [19 bytes]
2021-11-30 15:29:42 < BINARY c2 3d d4 6a 46 f1 50 2b a8 89 33 3a d4 3a 38 87 5a 01 00 00 00 ff ff [23 bytes]
2021-11-30 15:29:42 < BINARY c4 9d 4d 0a c2 30 10 85 af 92 95 6b 93 26 4d 8b ... a7 b0 1e 00 00 00 ff ff [216 bytes]
2021-11-30 15:29:42 < BINARY c2 9f 8a f1 8d bc 8f a6 62 70 ec 01 eb 31 73 f4 ... d6 a9 18 00 00 00 ff ff [73 bytes]
2021-11-30 15:29:42 < BINARY c2 b7 61 d3 cc 98 b2 0d 9b 96 56 86 e6 7a c6 d4 ... 75 b7 19 00 00 00 ff ff [108 bytes]
2021-11-30 15:29:42 < CLOSE 1000 (OK) [2 bytes]
2021-11-30 15:29:42 = connection is CLOSING
2021-11-30 15:29:42 > CLOSE 1000 (OK) [2 bytes]
2021-11-30 15:29:42 % sending keepalive ping
2021-11-30 15:29:42 Sending heartbeat (seq: None)
#

(repeat about 20 times) {
  2021-11-30 15:29:42 New event received, checking if handler exists for opcode: 0
  2021-11-30 15:29:42 Event handler found, ensuring async future in current loop.
}

2021-11-30 15:29:42 = connection is CLOSED

(repeat about 100 times) {
  2021-11-30 15:29:42 `presence_update` middleware has been invoked
  2021-11-30 15:29:42 `payload` middleware has been invoked
}

2021-11-30 15:29:42 Connection closed successfully.
2021-11-30 15:29:42 Waiting for new event.
2021-11-30 15:29:42 x closing TCP connection
2021-11-30 15:29:42 Connection closed successfully.
2021-11-30 15:29:42 Waiting for new event.
2021-11-30 15:29:42 Sending heartbeat failed. Ignoring failure... Client should automatically resolve this issue. If a crash occurs please create an issue on our github! (https://github.com/Pincer-org/Pincer)
2021-11-30 15:29:42 Connection closed successfully.
2021-11-30 15:29:42 Waiting for new event.

(repeat about 100k times) {
  2021-11-30 15:29:42 Connection closed successfully.
  2021-11-30 15:29:42 Waiting for new event.
}

[PTERO SERVER DIED]
#

I really dont have any idea on how to fix it and if you are wondering the repo is mine

fervent edge
#

Iโ€™m having trouble trying to think of how to implement flask_login in an api style?
Iโ€™m using react for front end, and flask for backend, and want to create sessions (Iโ€™m using google login). Just unsure how to achieve the session part and actually logging in on the front end side. How would I go about it?

#

When a user logs in (they use google sign in) a token is given to the backend, the backend verifies the token, and then creates an entry in the database with a user if it doesnโ€™t exist..
Just unsure what to do from here forwards

warped heart
#

if you dont handle that then that might be the reason

neon mortar
gritty hedge
#

Erm... what do I do to start?

native tide
#

is there any way to display the first 100 characters of a textField in django

sinful tulip
#

In a django project each app interacts with other app. there are many imports from one module to other.

  1. how to handle the too many imports in a module ?
  2. how to handle commons imports across modules ?
native tide
#

hi

#

pls

#

help

#

i want to learn front end

inland oak
native tide
#

?

inland oak
native tide
#

what?

native tide
#

?

inland oak
#

this is a good book to get started in frontend

native tide
#

i k

#

but my mom wont buy me

#

she dont support me

#

am just 13

inland oak
#

Sometimes people get books for free, if they seek hard enough ducky_pirate

#

Getting education in University costs much more in general though

native tide
#

i am learning to code for 3 months

inland oak
#

the cost of the books is almost nothing in comparison to regular education

#

Plus, I usually find it more satisfying to read paper copy. It allows to relax from PC

native tide
#

kk

#

by

#

my step mom is coming

#

oh noooo

unkempt temple
#

yo can someone tell me the basic file structure of a django project hosted by apache2?

#

i'm on CentOS 8 and python3.6

#

I already got mod_wsgi working

#

I just can't figure out for the life of me how to actually serve any content

#

with django*

#

i've been building websites in PHP and apache2 for several years so i'm familiar with most of the concepts, you don't gotta sugar coat anything for me

#

not sure if it matters but the site is a <VirtualHost *:443>

#

at py.mywebsite.com

#

this is what I currently see

#

ping me if you have django + apache/httpd experience

inland oak
#

Django is working with gunicorn or similar webserver at port 8000 for example

#

apache is used as reverse proxy

#

80 / 443 ports point to your Gunicorn server (localhost:8000)

#

optionally u disable 80, by making it redirecting to 443

#

in addition you write there, that static files for this web server are taken from a certain django folder with already compiled static files

unkempt temple
#

I don't have Gunicorn installed

inland oak
#

Apache is not supposed to be able to work with it as far as I know, it should used only as reverse proxy and static files server

unkempt temple
#

Really? I was told Apache would be supported as long as I had mod_wsgi installed

inland oak
#

All right. U can skip Gunicorn if u wish.
But it is usually easier to do it with gunicorn or some familiar for you way, instead of learning again

unkempt temple
#

I'm intending to write my restful api using python, but the main website with php

#

unfortunately Apache has a lot of features that I really need access to

#

and I don't wanna rewrite my whole httpd config to be compatible

inland oak
#

as I said Apache can be used easily as reverse proxy

#

that allows to access all of its features easily

unkempt temple
#

so apache would send it to gunicorn and gunicorn would send it to python?

inland oak
unkempt temple
#

I see

#

seems a little 'inefficient'

#

especially for the API side of the site

inland oak
#

shrugs. Go with Apache as python web server if u wish

inland oak
#

and that allows me to use Nginx instead of Apache

#

Nginx is a bit more popular and prefered, and considering that I was not lazy to go through learning its all features... I will not change it until better tool would be released.

#

or probably i use it because it was the first way which I learned how to setup it ๐Ÿค”

#

anyway, i think read somewhere that nginx handles multiple connections better than apache

#

and considering that nginx works fine for me to cache stuff in different ways / setting up security things and other stuff

#

I will not switch to other tool, considering that I don't know if apache can perform simlar things (caching for example)

unkempt temple
#

apache does have multiple caching, security, and supports multiple connections and multi-threading

inland oak
#
โ€œNginx was written specifically to address the performance limitations of Apache web servers.โ€
unkempt temple
#

I don't think that it applies anymore that nginx is faster, i bet that quote is from when nginx was created (many years ago)

#

mostly I don't want to switch because it will be a giant pain to re-write the configuration files

inland oak
#

I ilke that F5 company that bought Nginx, distributes O'Reilly books for free, including full book about Nginx

#

I think I am just bought by their generosity

unkempt temple
#

either way I still need help setting up apache to serve this content

#

this is what my config looks like ```xml
<VirtualHost *:443>
ServerName py.mysite.com

SSLCertificateFile /var/www/mysite.com/private/SSL/domain.crt
SSLCertificateChainFile /var/www/mysite.com/private/SSL/chain.pem
SSLCertificateKeyFile /var/www/mysite.com/private/SSL/domain.key

Alias /static/ /var/www/mysite.com/static/
<Directory /var/www/mysite.com/static>
    Require all granted
</Directory>

# django
#LoadModule wsgi_module modules/mod_wsgi.so
#WSGIScriptAlias / /var/www/mysite.com/py_api/wsgi.py
#WSGIPythonHome /path/to/venv
#WSGIPythonPath /var/www/mysite.com
#WSGIDaemonProcess mysite.com python-path=/var/www/mysite.com #python-home=/path/to/venv 
#WSGIProcessGroup mysite.com

#<Directory /var/www/mysite.com/py_api>
#    <Files wsgi.py>
#        Require all granted
#    </Files>
#</Directory>

</VirtualHost>```

#

I can't figure out what stuff I need to comment/uncomment

inland oak
#

WSGIPythonHome is also obvious, venv is created at same level where u have root of your django folder

#

WSGIPythonPath is a bit weird one

unkempt temple
#

I haven't created a virtual environment, I don't intend on using any libraries that aren't globally installed

inland oak
#

WSGIPythonPath is a path to root folder with Django project apperently. Root folder from which python modules will be imported

vernal thistle
#

If my form only has a submit button, and no input fields, do I need to worry about csrf protection?

inland oak
#

WSGIDaemonProcess and WSGIProcessGroup looks like using same variables already, so it should not be an issue for you

inland oak
#

which python should point address, or it could be somewhere in /usr/local smth
U will need adress that leads to folder with folder bin

lavish prismBOT
#

:incoming_envelope: :ok_hand: applied mute to @native tide until <t:1638423973:f> (9 minutes and 59 seconds) (reason: duplicates rule: sent 4 duplicated messages in 10s).

inland oak
#

venv usually has folder bin from where it goes to python binary

inland oak
#

and having venv installed as part of image

#

it will make considerable part of server settings as a code and life easier in general

#

plus having it frozen for reusage between development and production environment

unkempt temple
#

alright I finally got django to serve something lol

#

I ended up just sucking it up and putting the site in a venv and using these two configurations ```py
WSGIDaemonProcess mysite.com python-home=/var/www/mysite.com/env python-path=/var/www/mysite.com
WSGIProcessGroup mysite.com

#

finally

inland oak
native tide
#

hey i need help

#

i have a model which store images

#

so i was using that image in my html

#

using

#

object.Image.path

#

but it is not showing it in my page

robust cradle
#

you shouldn't be storing images in your db via a model. Store a reference to the asset (string) like the image in an s3 bucket

swift zephyr
#

Any Flask boilerplate that can be used in production, if there is github repo than great โœ”๏ธ

robust cradle
fickle mantle
#

Anyone in here that can help me with a Flask-Dance issue? I cannot figure out how to get email address from linkedin provider.

fickle mantle
slate swift
#

hello

#

i need one thing

#

i need the code to write the animated text that goes from left to right

#

can any1 just type me one >

#

one that says 'The End'

#

just that

vernal thistle
edgy sable
#

Hello I have a question can I make my api with flask without port just the domain

fickle mantle
autumn veldt
#

hi

#

dos someone know how to run my flask app on my network ?

frank shoal
#

flask run -h 0.0.0.0 -p 80

autumn veldt
#

i did this: app.run(host="0.0.0.0")

#

and its not working

frank shoal
#

can you connect at localhost?

autumn veldt
#

let me tru

#

try

#

nope

frank shoal
#

Paste your app startup log?

autumn veldt
#

you mean this:

 * Serving Flask app 'pi' (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on all addresses.
   WARNING: This is a development server. Do not use it in a production deployment.
 * Running on http://192.168.1.216:5000/ (Press CTRL+C to quit)
#

?

frank shoal
#

you connected on the same host, right?

autumn veldt
#

yes

#

i have here 2 pc's

frank shoal
#

Does it work if you don't add host=...?

autumn veldt
#

i didnt tried

frank shoal
#

it should just bind to 127.0.0.1:5000

autumn veldt
#

its the same log

frank shoal
#

Did you save?

autumn veldt
#

the file ? yes

#

i running the file from the ide

#

run it in other way ?

frank shoal
#

run it using flask run instead

autumn veldt
#

how do i install the flask command

#

?

#

from pip ?

frank shoal
#

app.py

app = ...

if __name__ == '__main__':
  app.run()

CLI:

flask run
autumn veldt
#

Ok

#

Error: Could not locate a Flask application. You did not provide the "FLASK_APP" environment variable, and a "wsgi.py" or "app.py" module was not found in the current directory.

#

il change the file name to app

frank shoal
#

app.py isn't in a package, right?

autumn veldt
#

no

#

its a py file

#

normal one

#

this is the log now:

 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
C:\Users\oriko\PycharmProjects\python-p\raspi-zero\app.py:22: Warning: Silently ignoring app.run() because the application is run from the flask command line executable. Consider putting app.run() behind an if __name__ == "__main__" guard to silence this warning.
  app.run("0.0.0.0")
 * Running on all addresses.
   WARNING: This is a development server. Do not use it in a production deployment.
 * Running on http://192.168.1.216:80/ (Press CTRL+C to quit)
frank shoal
#

Consider putting app.run() behind an if __name__ == "__main__" guard to silence this warning.
You should do this.

autumn veldt
#

now this is the log:

 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on all addresses.
   WARNING: This is a development server. Do not use it in a production deployment.
 * Running on http://192.168.1.216:80/ (Press CTRL+C to quit)

#

now what ?

frank shoal
#

What is the full command? flask run that's it?

autumn veldt
#

yes

#

thank you

#

this is the log

#
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
frank shoal
#

There. Now try connecting to localhost:5000

autumn veldt
#

yes

#

umm

#

not working

#

its telling that mybe the domain was moved or that is not active now

#

@frank shoal

frank shoal
#

Is this not on your local pc?

autumn veldt
#

wdym

frank shoal
#

is it on your desktop, or a linux server/raspberry pi?

autumn veldt
#

i tried to get to the web server on my phone

#

its on my windows pc

#

but

frank shoal
#

that won't work. localhost only works if it's on the same machine.

autumn veldt
#

i gona put it on raspberry pi zero w2

#

ho

#

well

#

i need to get to this from other pc

frank shoal
#

focus on localhost first for a baseline

autumn veldt
#

its working on my own pc but its not helping

#

i know the base of the localhost

frank shoal
#

Now that we've confirmed that, run flask run -h 0.0.0.0 -p 80

autumn veldt
#

ok

#
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on all addresses.
   WARNING: This is a development server. Do not use it in a production deployment.
 * Running on http://192.168.1.216:80/ (Press CTRL+C to quit)
frank shoal
autumn veldt
#

not working

frank shoal
#

same machine?

autumn veldt
#

same machine working

#

but others not

frank shoal
#

If it's on the same network, it's a windows firewall issue

autumn veldt
#

firewall issue on my pc or the other pc ?

frank shoal
#

on the host.

#

it blocks incoming connections.

autumn veldt
#

you mean from the pc that runs the file

#

ok

frank shoal
#

if your network mode is set to public, setting it to private may resolve it.

autumn veldt
#

how do i do this ?

frank shoal
#

should be in windows network settings

#

are you on windows 10 or 11?

autumn veldt
#

10

autumn veldt
#

im not using wify

#

wifi*

#

its on private

#

already

frank shoal
#

Do you want to disable the firewall (easy) or open a port (secure)?

autumn veldt
#

umm i want the port to be secure i think

#

but wait

#

i dont need to

#

disable the firewall i guss

frank shoal
#

search for firewall in start. It should be straightforward.

#

You can do it straight from Windows Security if you like.

#

Since you plan on putting it on a pi, you can disable the firewall now and reenable it later when you move it to a dedicated host.

autumn veldt
#

wait im searching for firewall and than what ?

frank shoal
#

just open windows security

#

then click "Firewall & network protection"

#

then click the active network, and click the slider to off

#

or add it to the allowed apps

autumn veldt
#

i have here only domain network private network and public

frank shoal
#

which one says "(active)"?

autumn veldt
#

there is only a green mark by all of tham

frank shoal
autumn veldt
#

no one

#

look

frank shoal
#

Open control panel > system and security > windows defender firewall

#

in the side panel, click "Turn Windows Defender Firewall on or off"

autumn veldt
#

wait

#

ok i caneld it

#

it was from the anti virus

frank shoal
#

that might also be it.

#

which AV do you use?

autumn veldt
#

look

#

i need to do something ?

frank shoal
#

Ok. Now does it work?

autumn veldt
#

one sec

frank shoal
#

or you didn't do anything?

autumn veldt
#

yesssssssssssssss

#

finalyyyyyyyy

#

thank u

#

and one more thing

frank shoal
#

remember to turn your firewall back on later.

autumn veldt
#

ok

#

do you play valorant ?

frank shoal
#

no.

#

And my graphics card recently died, so I'm limited to 10 year old games.

spiral blaze
#

<form method="POST" action="" enctype="multipart/form-data">

#

what does enctype mean?

frank shoal
#

enc means encoding

warped heart
#

with readthedocs, it cant seem to find my added node, which works fine locally?

Error

Exception occurred:
  File "/home/docs/checkouts/readthedocs.org/user_builds/acord/envs/latest/lib/python3.8/site-packages/sphinx/writers/latex.py", line 2084, in unknown_visit
    raise NotImplementedError('Unknown node: ' + node.__class__.__name__)
NotImplementedError: Unknown node: AttrTable
The full traceback has been saved in /tmp/sphinx-err-m77m996s.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!

Code

class AttrTable(nodes.General, nodes.Element):
    pass

...

def setup(app):
    app.add_directive('attributetable', PyAttrTable)

    app.add_node(AttrTable, html=(visit_AttrTable_node, depart_AttrTable_node))
    ...
dusk portal
#

im making a quiz type application in django
but idk why my post request isnt working correctly
it has 4 options a b c d
but idk how when im printing the answer(the post request) it's showing on that isn't on the option

lilac solar
#

Looks like you're not setting a value on the html input elements for the answer

rotund perch
#

Hello guys ive got a django app hosted on heroku it was working fine but now it throws a 500 server error and error logs are not helpful sending 500 error also without any further data. I have another django app and its also not working...

lilac solar
rotund perch
lilac solar
edgy sable
#

My Apache website dont work with the Port 80 ?

#

You don't have permission to access this resource.

edgy sable
#

AH00035: access to / denied (filesystem path '/var/www/website') because search permissions are missing on a component of the path

manic crane
#

How to display the names instead of pk in the list viewset in Django Rest Framework?

native tide
#

how do I get the pk of the item currently in view?

#

To give more context, I am working on a django project. There is a model for a class. The class is supposed to have a messaging board and they have to click on a button to create a new message. The message model has a variable for class. How do I automatically set the class when they click on the button to create a message?

velvet oyster
#

can you make a website with python

#

i heared you can only use html

native tide
#

to make a server

#

but the web devlopment is in Html and Css

native tide
#

no django

#

I figured it out

#

Hello l have err in django

the errr is:
ValueError: ModelForm has no model class specified.

native tide
#

I failed

tired kraken
#

Hello there, anyone here could know why I'm getting error on py manage.py createsuperuser ? I'm doing a Django project via Docker and need to create an admin

native tide
#

do you recommend guys start making projects to learn programming now I learned the basics of Python?Like functions,loops,etc...

drifting furnace
#

After you learned the basics

#

It's all practice

native tide
#

okay

tired kraken
#

I would learn a bit of unit tests first

native tide
#

thats the way I can master my career

tired kraken
#

Just few of those on the small stuff you've created

#

Like calculator etc.

native tide
#

and Django is simple to learn or directly make projects

#

cause it will be my first framework as backend

tired kraken
#

I'm currently working on Django project

native tide
#

Django is great, but it does have a fair amount of magic. Something like flask has less magic and is often easier to understand.

indigo kettle
native tide
#

Is it unsafe to have a static IP and host from your home internet?

inland oak
#

the biggest issue is that you supervise a server in a manual way

#

that is having a big time cost

native tide
#

I just bought one for $5 a month

#

Np

#

Problem solved

inland oak
#

it will be especially terrible if u install baremetall regular operational systems

#

but...

#

if u will install something to create virtual machines from this server

#

it will be a bit better in my opinion

#

but still a lot of time waste...

#

...cloud providers save so much trouble

inland oak
native tide
#

Ok

stark tartan
#

How to use GitHub actions or when I push the code to master branch it should be get automatically update to my nginx web server(on my instance) django

scenic galleon
#

is it possible to inject a javascript into a redirected site? like when redirecting i need it to load the redirected site and alert("Your form has been submitted!")

inland oak
scenic galleon
#

without a chrome ext?

inland oak
#

U could check for Oauth registrations/authorizations

#

They allow to redirect to other web site, proceed through login, and then return back to the source web site

inland oak
#

if they don't have developed ways to do that... then no, all your javascript u should do at your site

inland oak
scenic galleon
#

ahh right gotchya

inland oak
#

the thing with which browsers fight with

#

and try to prevent as much as possible

scenic galleon
#

๐Ÿ‘

royal bison
#

im very new to coding and am currently learning django. is there a difference if i use VScode's terminal vs windows' cmd?

inland oak
# royal bison im very new to coding and am currently learning django. is there a difference if...

not really. no difference. well, with few exceptions:

  1. VScode makes auto discover of venv if possible (basically activates venv for u)
  2. The biggest difference that u can launch interactive visual debug when running from VScode, with usage of breakpoints and using GUI to see values.
    but there is console debugger for python that requires no IDEs to use, it gives a similar experience, easier to setup, but less GUI to use
#

But in reality I use VScode terminal almost never.

#

Because unit testing is much more superior than visual debug

sudden sierra
sudden sierra
native tide
#

this is the code

#

so how it should be?

sudden sierra
#
from django import forms
from django.contrib.auth.models import User


class UserCreationForm(forms.Form):
    class Meta:
        model = User
        fields = ('username', 'email', 'first_name', 'last_name', 'password')
sudden sierra
#

Because django doesn't what model these fields belong to if you didn't specify the model

native tide
#

okie it worked

#

but the forms isnt in the page

#
{% block content %}
{% load crispy_forms_tags %}


<!-- Comment Form -->
<h3 class="border-bottom pb-3 mb-3 mt-5">ุงู„ุชุณุฌูŠู„</h3>
<div class="border p-4 mb-5 mt-4">
    <form method="POST">
        {% csrf_token %}
        {{form|crispy}}
        <input class="btn btn-secondary" type="submit" value="ุชุณุฌูŠู„">
    </form>
</div>
{% endblock content %}```
#

I made an register.html where the user put the data

sudden sierra
native tide
#
from .forms import UserCreationForm



def register(request):
    form = UserCreationForm()
    return render(request, 'user/register.html', {
    'title': 'ุงู„ุชุณุฌูŠู„',
    'form': form,
    
    })```
sudden sierra
#

I'm not sure if writing {{form.as_p|crispy}} instead of {{form|crispy}} in the template would solve the issue, would you try it?

native tide
#

or wait

#

I found a fix ig

#

no it also didnt work

sudden sierra
native tide
sudden sierra
# native tide the form
from django.shortcuts import render
from .forms import UserCreationForm



def register(request):
    if request.method = "GET":
        form = UserCreationForm()
        return render(request, 'user/register.html', {
    'title': 'ุงู„ุชุณุฌูŠู„',
    'form': form,
    
    })

Try this

dusk portal
#

im making a quiz type application in django in which i also want to give user score
correct , wrong answers he wrote n store it all on db
the issue is when user is entering correct answer then it should add +4 in score n +1 in correct
it's adding +1 in correct but idk why it's showing wrong=1 (that isn't) and -1 in score

#
if answer == queryset.answer:
            score+=4
            correct+=1
        else:
            score=-1
            wrong+=1```
#

i checked by printint (answer) yeah it's correct (it's also giving +1 in correct)

#

so i rn
selected b
n yes it added +1 on the correct
on score it should at +4 but idk why its showing -1

#

it should show 4 in score

royal bison
inland oak
#

anyway, I can recommend Terminal Multiplexors

#

in general usage they are the most comfortable way to run stuff

#

Terminator and Konsole for linux are cool

sudden sierra
dusk portal
#

stuck on a logic

native tide
sudden sierra
sudden sierra
#

In views.py:

from django.shortcuts import render
from .forms import UserCreationForm



def register(request):
    form = UserCreationForm()
    return render(request, 'user/register.html', {
    'title': 'ุงู„ุชุณุฌูŠู„',
    'form': form,
    
    })

In forms.py:

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


class UserCreationForm(forms.ModelForm):
    class Meta:
        model = User
        fields = ('username', 'email', 'first_name', 'last_name', 'password')โ€Š
sudden sierra
native tide
#
from django.contrib.auth.models import User


class UserCreationForm(forms.ModelForm):
    username = forms.CharField(label='ุงุณู… ุงู„ู…ุณุชุฎุฏู…', max_length=30,
                               help_text='ุงุณู… ุงู„ู…ุณุชุฎุฏู… ูŠุฌุจ ุฃู„ุง ูŠุญุชูˆูŠ ุนู„ู‰ ู…ุณุงูุงุช.')
    email = forms.EmailField(label='ุงู„ุจุฑูŠุฏ ุงู„ุฅู„ูƒุชุฑูˆู†ูŠ')
    first_name = forms.CharField(label='ุงู„ุงุณู… ุงู„ุฃูˆู„')
    last_name = forms.CharField(label='ุงู„ุงุณู… ุงู„ุฃุฎูŠุฑ')
    password1 = forms.CharField(
        label='ูƒู„ู…ุฉ ุงู„ู…ุฑูˆุฑ', widget=forms.PasswordInput(), min_length=8)
    password2 = forms.CharField(
        label='ุชุฃูƒูŠุฏ ูƒู„ู…ุฉ ุงู„ู…ุฑูˆุฑ', widget=forms.PasswordInput(), min_length=8)

    class Meta:
        model = User
        fields = ('username', 'email', 'first_name',
                  'last_name', 'password1', 'password2')

    def clean_password2(self):
        cd = self.cleaned_data
        if cd['password1'] != cd['password2']:
            raise forms.ValidationError('ูƒู„ู…ุฉ ุงู„ู…ุฑูˆุฑ ุบูŠุฑ ู…ุชุทุงุจู‚ุฉ')
        return cd['password2']

    def clean_username(self):
        cd = self.cleaned_data
        if User.objects.filter(username=cd['username']).exists():
            raise forms.ValidationError('ูŠูˆุฌุฏ ู…ุณุชุฎุฏู… ู…ุณุฌู„ ุจู‡ุฐุง ุงู„ุงุณู….')
        return cd['username']```
#

I made the code like this

#

and it worked :)

sudden sierra
#

That's good ๐Ÿ‘

manic frost
rough tulip
#

I am trying to store main user and his/her team data but when user type the number of people in his/her team then the below team details must be change to that number of fields in admin panel

#

so how can achieve this

sudden sierra
stoic lark
#

Hello guys anyone have CSGO website Template ? for community gather games ?

tired kraken
rough tulip
granite mirage
#

Anyone can briefly tell how to deploy django on apache

native tide
#

How do registering of models work in django?
Like I have created an app "myapp" (an api app - has all the routes and models for a rest api) and in it's models.py, and whatever model I create and migrate, it reads that file automatically.
But I need to split the models.py into multiple files each one in different folders (all in the same app)... I guess django won't register them automatically then... So what should I do to achieve this?
Not sure but should I do admin.site.register() or something like this?

native tide
native tide
#

is hostinger vps good for a django application ?

indigo kettle
native tide
dense slate
#

@inland oak Have you heard of the CPython front-end scripting? Any experience with it?

inland oak
inland oak
dense slate
#

Yea, I have doubts.

#

Unless it has some huge benefits over JS, it's unlikely to take over. But I think speed is one of the supposed advantages.

inland oak
#

Not the mentioning lack of developed libraries / ecosystem for that

inland oak
native tide
#

except digital ocean

#

pythonanywhere good ?

inland oak
#

I would recommend to choose from Digital Ocean, Vultr, Linode, Hetzner

#

Or if u wish challenge, then AWS, GCP, Azure

#

Possibly Alibaba can be good, but haven't tried it

manic frost
#

but I don't think it's going to take over either ๐Ÿ™‚

undone heath
#

I shoul use a soap web services only accessible by vpn and I have the wsdl file how can use this wsdl file to generate python code ?

edgy sable
#

My Apache website dont work with the Port 80 ??????????????????????????
You don't have permission to access this resource.
AH00035: access to / denied (filesystem path '/var/www/website') because search permissions are missing on a component of the path

safe heath
strong oak
#

Is it better to build a website in flask or Django?

balmy knoll
#

guys i have a little problem: the html is not finding the image "image.jpg". Can anyone help me solve this problem?

#

here is the tag to show the image

native tide
#

import fromurl

#

assuming ur using flask

#

and google what to do

#

fromurl module

#

within flask

#

and django maybe idk

balmy knoll
native tide
#

are you using flask or django

balmy knoll
#

flask

native tide
#

then you need fromurl imported and google how to use it

lavish prismBOT
#

Hey @lost frost!

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

lost frost
#

hi all,

I am making this slackbot

The code here https://paste.pythondiscord.com/bazajadalo.py
contains a segment with the flask endpoints commented

I am trying to add it either in the main method or create a class and add call it from the main method.

any advise would be appreciated it ..
The code was working in a script way but I am trying to OOP it

fickle marsh
#

can someone helpme to "translate" this code of python 2 to python 3?

#

`from flask import Flask, render_template, request
import sqlite3 as sql
app = Flask(name)

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

@app.route('/enternew')
def new_student():
return render_template('student.html')

@app.route('/addrec',methods = ['POST', 'GET'])
def addrec():
if request.method == 'POST':
try:
nm = request.form['nm']
addr = request.form['add']
city = request.form['city']
pin = request.form['pin']

     with sql.connect("database.db") as con:
        cur = con.cursor()
        
        cur.execute("INSERT INTO students (name,addr,city,pin) 
           VALUES (?,?,?,?)",(nm,addr,city,pin) )
        
        con.commit()
        msg = "Record successfully added"
  except:
     con.rollback()
     msg = "error in insert operation"
  
  finally:
     return render_template("result.html",msg = msg)
     con.close()

@app.route('/list')
def list():
con = sql.connect("database.db")
con.row_factory = sql.Row

cur = con.cursor()
cur.execute("select * from students")

rows = cur.fetchall();
return render_template("list.html",rows = rows)

if name == 'main':
app.run(debug = True)`

unkempt temple
#

How do I prevent this page from showing up?

#

Nobody who is unauthenticated should be able to view this page

#

This is what the view looks like for now py @api_view(['GET', 'POST']) @authentication_classes([TimeBasedTokenAuthentication]) def users(request): if request.method == "GET": return Response(UserSerializer(User.objects.all(), many = True).data) elif request.method == "POST": serializer = UserSerializer(data = request.data) if serializer.is_valid(): serializer.save() return Response(serializer.data, status = 201) return Response(serializer.errors, status = 400)

golden bone
unkempt temple
#

I'm getting a 403 error

#

I just don't really want people to be able to see this page in their browser and play around with the options

#

I'd prefer to see a generic 403 forbidden page

#

p.s. Debug is already set to False

astral pagoda
#

Can someone help me with a name of a .hmtl file?

In the code after you register an email; an email is sent to you. Then a new html page is rendered after you click on the email. What should I name the .html after the email is clicked on?

unkempt temple
#

Added this configuration option in my settings.py py REST_FRAMEWORK = { 'DEFAULT_RENDERER_CLASSES': ( 'rest_framework.renderers.JSONRenderer', ) }

#

the BrowsableAPIRenderer is included by default, and manually setting it to this removes that option

sinful hill
#

Hi all,

Im trying to set my sessionid created by django back to my vue frontend. its not working right now. I was wondering why. on the console its showing the values and all. There was a reddit post about this issue and he solved it by moving the code to the server. Im just testing locally right now. Just wanna hear some opinions before i go ahead and do that

#
  csrftoken = request.COOKIES.get('csrftoken')
  response = redirect('vue/')
  response.set_cookie('sessionid', sessionid)
  response.set_cookie('csrftoken', csrftoken)
  print(response.headers)
  print(response.cookies)
  return response```
heavy ferry
#

does anyone know a good HTML/CSS framework that would make this UI easy to make using django?

native tide
mystic vortex
#

guys need some help

#

i am trying to make a discord bot dashboard

#

and i am using discord oauth to verify the user

#

but even after the verification the oauth i redirecting me to the same page

native tide
#
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.```
#

how fix this error

marsh girder
heavy ferry
#

i said framework

#

yall are useless trolls

#

boostrap is fine to me for now

sinful hill
#

You gotta keep in mind everyoneโ€™s a learner here. Someone giving you advice might not actually know exactly what you want or even have the knowledge. Doesnโ€™t mean theyโ€™re trolling you

sinful hill
sinful hill
#

Just do it in the terminal instead of vs code

native tide
mystic vortex
#

this site works when i run it on my local machine but it doesnt work when i try to run it on repl.it

thorn igloo
mystic vortex
#

the code ```py
@app.route("/login")
async def login():
return await discord.create_session()

@app.route("/callback")
async def callback():
try:
await discord.callback()

except Exception:
    return redirect(url_for("dashboard"))


return redirect(url_for("dashboard"))

@app.route("/dashboard")
async def dashboard():
conf = await discord.authorized
if not conf:
return redirect(url_for("login"))

heavy ferry
#

i said framework...

#

framework...

#

framework...

thorn igloo
#

you're still using css classes in an html file

heavy ferry
#

you clearly dont know what a framework is

mystic vortex
#

thats a good one

heavy ferry
mystic vortex
#

try it out

mystic vortex
ember mist
#

hi

heavy ferry
#

i dont get why people try to troll in servers meant for discussion about stuff

ember mist
#

may dsalgo kayo

thorn igloo
#

bruh... nvm

mystic vortex
ember mist
#

im karlo im desperate?

mystic vortex
#

ah u can go to ot

#

!ot

lavish prismBOT
short venture
wooden lodge
#

Does anyone have any experience with using channels and django before?

#

Because I am getting a WebSocket connection failed error

lime scroll
#

Hey I have a question, I am very new to web development and stuff. Someone wanted me to add a function to their code and only gave me the file which directs me to the web

#

and the code is on the developer page thing but how do I edit it? I tried making some changes but it wouldn't let me save them

native tide
jovial cloud
stable oracle
#

Has anyone set up a simple Digital Ocean droplet soley to use its ip address to redirect an old website to a new one? I have the droplet created but I don't know where to go from here. I was asked to drop a simple text file to see the page live, but how do I get to that? I have an ssl cert installed, but was asked to open port 80 then redirect that to 443 and then I would need to redirect from there to the new website. Any help or tips would be great.

dense anvil
#

Does anyone know about decent articles or tutorials or resources in general for UDP sockets in python pixels_snek_2

opaque rivet
late gale
#

hello guys mind i ask something how do big companies like google microsoft build their website like they use only one backend framework ? or they use a frontend framework and create a rest api from a backend framework

meager anchor
#

google and microsoft both have 500 different websites that probably all use a different mix of stacks

#

if you are trying to figure out what to use for your own project, pick whatever you are comfortable with or want to learn

indigo onyx
#

hey, i'm working with flask to make a private file upload service for myself and it works great, the only issue is the server denies files that are too large in size

#

is there a way to increase the content-length header for a single path without changing it for the entire app?
because that's what settings MAX_CONTENT_LENGTH does
thanks

golden bone
stable oracle
hushed vortex
#

anyony good with html?

hushed vortex
native tide
lapis glade
#

can http.server use another python script to serve different pages

lapis glade
#

main.py is running a web server, can script.py serve a page somehow on the same server

jovial cloud
native tide
#

hey so i made a code on visual studio code

#

and i'm trying to upload it to online website(something like google sites or anythign that's free)

#

and make it interactive so like user can input a setence to a website and it will return the output

#

is there a youtube video i can follow?

#

So the "=Predicted as: 'tech" would be returned by the website

digital hinge
edgy sable
#

But nothing

spiral blaze
#
<div class="modal-footer">
  <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
    <form action="{{ url_for('delete_post', post_id=post.id) }}" method="POST">
        <input class="btn btn-danger" type="submit" value="Delete">
    </form>
</div>
#

im using bootstrap, why is my Close and Delete buttons misaligned?

#

I dont think the code is wrong?

tropic blaze
#

Hey everyone, I am currently in my 3rd year of Engineering and I am familiar with Python and basics of C++. And now I am thinking about learning either Django or JS. Can anyone guide me?

#

I have started learning about Django but having a hard time learning it Since I don't know from where to start?

hazy wolf
#

hey sorry to bothering you but, is there someone who know french and know well django/frameworks?

lapis glade
inland oak
# tropic blaze I have started learning about Django but having a hard time learning it Since I ...

if to learn Django, I would recommend starting from documentation, they have tutorial to learn it in 7 steps
https://docs.djangoproject.com/en/3.2/

if documentation is not enough, there is more comprehensive way to go with books
Django for beginners
Django for professions
Django for API
by William S. Vincent

If to learn Javascript, I would recommend this book
https://www.amazon.co.uk/Head-First-JavaScript-Programming-Freeman/dp/144934013X

if to learn HTML/CSS, similar book "Head First CSS" exists.

autumn veldt
#

hi can someone help me: im running a flask app that run on the local wifi on host 0.0.0.0 and port 80 and its work on my pc but whan i run this on my raspberry pi zero w2 it shows me this error:

PermissionError: [Errno 13] Permission denied
#

can i get an help pls ?

#

wait

#

yes

#

i cant send the full error

#

this is the code:

import glob
import os.path

from werkzeug.utils import secure_filename
from flask import Flask, request, redirect, url_for, render_template


app = Flask(__name__)

@app.route('/')
def index():
  return "{'msg':'welcome'}"

@app.route('/send', methods = ['GET', 'POST'])
def upload_file():
   if request.method == 'POST':
      f = request.files['file']
      f.save(secure_filename(f.filename))
      return 'file uploaded successfully'


@app.route('/get/<path>')
def get(path=None):
    if path == None:
        return "{'msg':'please enter a path'}"
    else:
        for file in [val for sublist in [[os.path.join(i[0], j) for j in i[2]] for i in os.walk('./')] for val in sublist]:
            if path == file[2:]:
                return open(path,"r+").read()
        return "{'msg':'please enter a valid path'}"

"flask run -h 0.0.0.0 -p 80"

if __name__ == "__main__":
    app.run("0.0.0.0", port=80)
#

at my pc it works

#

so you know what the problem is ?

#

@native tide

#

you here ?

#

no

#

ho wait yes

#

33

#

umm

#

no its no

#

its not telling

#

i cant

#

its to long

#

yes

#

see

#

wait

#

whan i run this with sudo it show me this:

pi@backup-server:~/Desktop $ sudo flask run -h 0.0.0.0 -p 80
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on http://0.0.0.0:80/ (Press CTRL+C to quit)
haughty isle
#

One recommended way is to use systemd to run gunicorn listening on a Unix socket and use nginx as a reverse proxy to host on 80 and 443

autumn veldt
#

umm

#

i didnt understand one word that you said

#

@haughty isle

autumn veldt
#

still idk what this is

inland oak
#

not sure why, I have the same

autumn veldt
#

nevermine i fixed that

inland oak
#

u can run freely with 8080 for example

lilac solar
#

Ports 1 to 1000 are reserved by the system for various services. I believe it's generally to be secure by default. This is a good example of not exposing an insecure Dec server over the default HTTP port which would allow an attack vector if the server was left running

#

It also means users cannot mess with key system level services if they were running on the server

tropic raptor
#

Why in Python3 is no function to handle PT ISO8601 string?
For example PT32M5S

outer cobalt
#

I am looking for well-experienced python web developers. Please DM me if you are.

native tide
#

flask

#

without a doubt

#

you'd have to write less code with flask and tailor it to your task more easily

grim terrace
#

@native tide you can use here for html asking

native tide
#

need some help with html, ping on reply pls lol

grim terrace
#

what is your question exactly tho lol

native tide
grim terrace
#

ah

native tide
inland oak
heavy ferry
#

anyone know how to make the search bar match the size of h1 tag that is set to 60px

dusty steeple
#

If I want use a discord bot to store a message/post (as a Postgres text field or in a file), and then using django to render those fields/files in html; am I barking up the wrong tree? Should I just be looking for a CMS like ghost or jekyll?

It seems like all the functions/views/classes are there in django (and postgres + python + django play together nicely) but it feels like there could be a lot of attack vectors if it gets opened to other users.

dusty steeple
inland oak
inland oak
inland oak
# heavy ferry

anyway, if u wish them matching in size... they just should be under one shared div

#

60px is height or width?

#

lets assume its height, make the div wrapping them as 60px

#

and inside let the elements have the height 100%

#

this will make them possibly not centralized though.

dispay: flex;
justify-content: center;
aligh-items: center;

flex is quite well able to center literally anything.

dusty steeple
inland oak
#

let HTML be telling structure, let CSS/SASS to style
let javascript to handle data model and to do everything else that first instruments can't do, but full programming language can

dusty steeple
#

True, true. Having all the layout in CSS makes the most sense.

#

Is that a general guideline for other areas? Having the implementation being according to tools? Or is it sometimes valid to keep the tool all in one place?

(i.e. in an integrated project, to have all the software according to purpose, or to have he purpose across different software according to best software?)

#

(not sure if my choice of words is good there)

inland oak
#

basically, we can be wishing to use specialized tools for everything, if we have need in them and we know why they are better than general purpose tools
but not everytime we have knowledge how to use them or why we need them, and learning them requires time that makes projects delivered later
it is all about skills we already have, and risks we have to learn them instead of using already known tools

dusty steeple
inland oak
#

the purpose of delegating to specialized member is usually so he could invest more time and experience to make it better than all around general purpose developer or developer that is not knowing how to do that at all

#

but eventually this is collaborative stage... so all around developers participate in this part always

#

as well as all other participants

dusty steeple
heavy ferry
#

im using bootstrap rows and cols does anyone know how to align the text inside of it to be center vertically