#web-development

2 messages ยท Page 143 of 1

swift wren
#

oh and that as well, the amount of files you need to download

wicked elbow
#

react and redux are both easy. i learned django, rest framework, react and redux all at once. that was definitely a fun process, but after the first run through its increadibly simple

serene prawn
swift wren
#

even tho its lik 2 commands, the amount of files it downloads is jsut horrific.

#

really?

serene prawn
#

They're all cool but angular and django come with batteries

gloomy osprey
#

NOT NULL constraint failed: MyServer_links.redirect_url

swift wren
#

flask would be react right?

serene prawn
#

Yep

swift wren
#

yeah seems why i like it more

#

i tried angular and i hated typescript

wicked elbow
#

no flask is backend react is front end....

quick cargo
#

KannaWhat jinja is nothing like react

swift wren
#

...

serene prawn
swift wren
#

really?

quick cargo
#

CS rendering is was diffrent than SS rendering

serene prawn
#

Not cs and ss rendering

swift wren
#

its legit a abstract comparision are you lot alrigh?

gloomy osprey
#

pls help me

swift wren
#

i think its because of the fact that im very old fashioned that i like python and c based programming paradigms and i dont really like new ways of programming languages, thats why me and js have a bad relationship

#

@gloomy osprey yeah go

quick cargo
gloomy osprey
#

line 82

swift wren
#

nah bud, if you have a not null constrain on your field, then if you left it empty its gonna cause issue

wicked elbow
#

flask django dont compare to react at all... angular either for that matter. front end vs backend data manipulation.

swift wren
#

yeah they do

quick cargo
swift wren
#

flask is a library, django is a framework

quick cargo
#

Errr not quite

swift wren
#

its mysql, its web based im pretty sure

quick cargo
#

Ehj?

wicked elbow
#

no... flask and django are both just like php and asp

gloomy osprey
wicked elbow
#

they are backends... thats all they are

swift wren
#

no shit bro are you high?

#

go and carefully read what was written

#

you are missing the point

quick cargo
#

Mysql isnt web based

#

You're just spurting nonsense lol

wicked elbow
#

no im not... your comparing apples to oranges

swift wren
#

@serene prawn help pls

serene prawn
#

???

quick cargo
#

That key wont exist in headers

#

So it's returning null

serene prawn
quick cargo
#

Man's arguing that flask and every other micro framework isnt a framework

swift wren
#

wha??

quick cargo
#

As well as Mysql apparently being web based ๐Ÿคฃ

wicked elbow
#

flask and django can both be ran by themselves. same with php and asp and any other backend languages. react can be ran by itself for a lot of things front end. angular has built in support for stuff that react doesn't but doesnt mean its required for it to work

swift wren
#

flask is a lib, django is a framework. react is a lib, angular is a framework. there are meta similarities, i'm doubting if you can read honestly

quick cargo
#

Flask is a framework

#

A library generally refers to the fact that it requires no set layout or way of doing things to be able to use it, flask has those requirements, just because it doesnt do the mass auto file generation that django does, doesn't make it not a framework

serene prawn
quick cargo
#

If i write a flask app and i structure it identically to Django's layout is it still a library or is it a framework at that poknt 02Shrug

serene prawn
#

Flask is just a router with extra whistles though

wicked elbow
#

depends on your definitions. django doesnt have a lot built in to work, websockets/json serialization for instance. flask doesnt either. again your comparing apples to oranges. and what you specifically need for your use case

serene prawn
#

compared to say django

#

Also i wouldn't use Flask anymore when there's FastAPI ๐Ÿ™‚

quick cargo
#

The only thing django does extra is the orm and the file generation

#

Flask is orientated about being lighter and more module than Django which is fair considering the fact that 70% of everything in django you never use

serene prawn
swift wren
#

true, but using django is faster if you want to build a full webapp if you compared both modules in terms of constructing the app.

quick cargo
#

I mean that depends on what you're doing, if its ecommerce sure

#

But not everything works as well im django's world

serene prawn
#

For api i would choose FastAPI or Django if i feel lazy ๐Ÿ˜…

swift wren
#

even if you want to make a scalable app, django would be faster

quick cargo
#

Sorta?

swift wren
#

but if you want 100% control over your application then django will fail you

quick cargo
#

Most large companies which hav3 dynamic frontends go with flask for that

#

Unless you're ecommerce

wicked elbow
#

you could for instance run react and query everytime your component loads. you can set context and use the data in other components. react/angular/vue are what you make them. same with django/flask/php/asp

swift wren
#

what is the difference between a eCommerce app and a normal webapp

quick cargo
#

Mostly what they involve using

#

And what django ultimately got popular for

serene prawn
#

Technically you can but it's not applicable for ui elements

quick cargo
#

Yeah and it's one of the main things with front end systems, the virtual doms are very powerful tools

#

But equally alot of websites doesnt really need it over ss other than its very nice to deploy on the edge and not worry about content delivery

wicked elbow
#

you cant server side render react or angular in django or flask. so i dont know why it matters. you'd be running a node.js backend. at least for the SSR im assuming your talking about. to pull data, build the page pass to the front end to rehydrate and deploy.

#

otherwise pass json and filter the data into your components. still not sure what benifit SSR actually would have in the long run

opaque rivet
#

SSR helps with SEO a lot. If you want SSR (or something similar) use next.js, it will improve your SEO as for JS apps it's quite terrible.

serene prawn
wicked elbow
#

if your talking server side redirection your wasting your time with a framework anyways. defeats the whole purpose of react/angular speed of delivery

opaque rivet
#

Django templates doesn't give you the freedom of JS frameworks. You will be hard pressed to not learn a JS framework, most jobs require them.

serene prawn
opaque rivet
#

And tbf react projects should either be done with next.js (react framework) or SSR, create react app has a better competitor giving more SEO and features out of the box.

serene prawn
#

I can't imagine dealing with even small that have any interactive elements without js frameworks

serene prawn
quick cargo
#

Im the same but im on team Vue

opaque rivet
#

Angular ๐Ÿ˜ญ ๐Ÿ˜ญ

quick cargo
#

As much as i like reacts ease of use styled components kill me

serene prawn
opaque rivet
#

I have angular prejudice I'm sorry

serene prawn
#

I heard that people don't like angular.js though

#

angular is pretty cool imo

quick cargo
#

I like most of angular's stuff but couldn't quite get used to the communication between components

serene prawn
#

Basically can act the same as store in other frameworks

swift wren
#

hey guys, i need to know the difference between express and node. ik it will probs be mad dumb but i just dont see the difference

#

cos both act like "wsgi" if i said that correctly

serene prawn
#

express is a library/framework

#

node is a runtime for js

swift wren
#

yeah but even then, if its a run time, why do people use it along side express

serene prawn
#

So you can run express?...

#

You can't run flask without python ๐Ÿ‘€

#

Same here

gloomy osprey
swift wren
#

no i saw this tutorial and this guy ran a node.js server and then made a different server in express with differnt ports

#

i didnt understand why he did that

#

even then, react has its own ss

serene prawn
#

You usually serve react via cdn or your node server can serve static files as well

#

Since your app would be just a compiled js file

swift wren
#

but then there is no need for express

serene prawn
#

Maybe he would write an api for that react app using express?

swift wren
#

cos cant raw node.js do the exact same thing that express does

serene prawn
#

It can, but it would be a pain ๐Ÿ˜‰

swift wren
#

really? man there are so many tangents in js.

serene prawn
#

There's no built-in routing or something

coral raven
#

How should I implement flask + react,
Flask runner on port 5000 as api, and react on the frontend making calls to port 5000
Or have both flask and react work on the same port

glacial dew
#

i am making a website in which i have to make some API calls in django, and i make these api calls everytime someone calls my homepage, due to this my home page takes a lot of time load

#

i wanted to establish a mechanism using which these api calls will be made periodically after few hours and my data will get updated

#

this way my home page won't take this much time to load everytime.

#

how to establish this??

strange dawn
#

Hi, i am learning FastAPI and i found this code exemple on github that i don't understand

class ArticleForResponse(RWSchema, Article):
    tags: List[str] = Field(..., alias="tagList")

what is Field ? what is the 3 dots ?

silver swan
#

Hey! I am working on a Django project.The issue I am facing is when I login in one of the non admin page (page which I created through LoginView Class in Django), it also automatically tries to authenticate admin login page and if the user is superuser, the admin page gets logged in even when the superuser does not want to login to the admin page and when a non super user logs in, again it tries to login in the admin page only to not get authorized. How do I not let automatic trial of admin login not happen?

serene prawn
#

For development you can use react server

serene prawn
#

Actually it can be just a function or anything but the main point is that it provides metadata for your model field

ornate burrow
#

where does dash change the tab title to updating? i want to check where it does this so i can add a loading bar on screen

#

and i cant find what im looking for in the documentation

#

or i am misunderstanding the documentation

distant trout
#

someone know if flask has an async extension? need to load in my view first because an API call is taking too long to load

serene prawn
#

@distant trout You can't "put" data in your view if you already sent it to the client

distant trout
serene prawn
#

Not really... If you already sent view to the client then how would you put your data in it? ๐Ÿค”

distant trout
#

i see sites do the loading spinning thing when a data is taking long to load

serene prawn
#

Consider using cache/javascript requests on frontend

#

Yeah, that's done with js

#

Usually with some js framework

distant trout
#

oh u think i can do it with react

serene prawn
#

angular is my personal favorite though ๐Ÿ˜‰
But it uses typescript so it can be hard to start with it

distant trout
#

ahh lol

#

ok thank u im gonna look into it right now

serene prawn
#

@distant trout Also if you're just starting or your backend is pretty small look into FastAPI

distant trout
serene prawn
#

Well, it has more features

#

Don't know about speed though

distant trout
#

ahh

serene prawn
#

But they're pretty similar and fastapi makes a good use of python type hints

distant trout
#

i see.. okay ill look into fastapi

quick cargo
#

Flask is way faster than people think

#

There generally is alot of miss-conception between asyncio being so much faster vs some other sync framework

serene prawn
#

according to techempower tests it's faster ๐Ÿค”

quick cargo
#

Ignore tech empower for anything other than the bench marking game of who's framework pipelines better eyerollgopher

serene prawn
#

๐Ÿ˜…

quick cargo
#

they're very miss leading benchmarks for the real world

serene prawn
quick cargo
#

I mean im not dis-agreeing that FastAPI is awesome for API's

#

its definitely my go to

distant trout
#

apparently fastapi uses ASGI and flask uses WSGI

quick cargo
#

yes and?

serene prawn
#

They're pretty similar, have similar performance, and fastapi has more features than flask

quick cargo
#

they're just different server interfaces for asyncio and not asyncio

serene prawn
#

Is there any reason to use flask anymore? ๐Ÿ˜…

quick cargo
#

The eco system support, testing support general performance and ease of scalability

#

better stability under high load

distant trout
#

if u had to pick a framework for a simple api, would it be flask or fastapi

quick cargo
#

FastAPI just because speed of setup

distant trout
#

ahh okay

#

fastapi docs are well done

#

also i see it autogenerates documentation

narrow bolt
#

How do i call foreign functions from c++ or is there a module for relating with assembly code.

serene prawn
narrow bolt
#

Oh okay, which is the correct channel to ask

serene prawn
#

probably

#

@narrow bolt

narrow bolt
#

Thanks

serene prawn
#

np

cloud path
#

guys

#

class ConfirmCharDelForm(FlaskForm):
token_ = secrets.token_hex(4)
tokenfield = StringField('Inserisci il codice di conferma per eliminare il tuo personaggio:', validators=[DataRequired(message="Inserisci il codice di conferma."), EqualTo('token_')])
submit = SubmitField('Conferma')

#

is this flask form made wrongly?

formal axle
#

from flask import Flask, render_template

return render_template('home.html')
why isnt this rendering
its saying invalid syntax

native tide
#

I have a survey for you,

Let's take for example that we want to make 100 Websites (100 domain names, we don't count the sub-domains)

Do you prefer to put 100 domain names in a dedicated server?
or one website per VPS, (total 100 VPS) ?

In my example 1 website is about less than 1000 visitors per month

quick cargo
#

you can pretty easily fit that in a single VPS

native tide
#

Impossible to put everything in a VPS, the hardware will be limited, especially the memory,

I take 1GB or 2GB of memory per VPS, it's enough for a small site

quick cargo
#

I mean we have a 10 core VPS that handles a few hundred thousand unique visitors a month with tens of billions of requests

#

web servers are not really that intensive

quiet ridge
glossy arrow
#

That looks cool

quick cargo
#

i think the scroll into view takes a lil too long to kick in though

#

its just about on the edge where it looks like it's just scrolling into a blank page rather than scrolling into view

stoic tulip
#

Hey! Iโ€™m Hari from India

#

How to start web development beginners to advance?

glossy arrow
#

And from there, move to learning JS and a python framework, such as Flask

quiet ridge
proper carbon
#

come stai

opaque rivet
wicked elbow
quiet ridge
wicked elbow
#

and the best animations are those that dont interfere with use of the site. like a bounce on mouse over, ect. but seriously id say the majority of people when they visit a site, wont care if its animated or not because none of the majorly accessed sites have any animation what-soo-ever

umbral bobcat
#

Hi all, I'm trying to convert a string in a flask form to uppercase but can't seem to get it to work, any ideas? I've tried saving the data to a var and applying .upper() as well as adding " |upper " in the jinja code, neither have worked for me

ocean dirge
native tide
#

does anyone have a coding website that i can use that has python on it?

ocean dirge
#

looks good but theres no product anywhere which could be confusing

quiet ridge
ocean dirge
#

ah

#

okay

#

does look good

quiet ridge
#

I m working a community for programmers

ocean dirge
#

nice

quiet ridge
#

so making some simple templates for my programmer clients ๐Ÿคฃ

opaque rivet
#

how many projects until you start looking for django fullstack jobs? ๐Ÿค”

steep olive
#

When I use ||from django.urls import path, include|| it doesn't work, I am using repl.it, any ideas?

nimble epoch
#

like maybe one or two projects just to show your skills if im right

edgy isle
#
from . import db
ImportError: attempted relative import with no known parent package
from . import db

Using application factory with blueprints

  - /project
    - /static
    - /templates
    - __init__.py
    - main.py

Error comes from main.py

opaque rivet
edgy isle
#
  - app.py
  - /project
    - /static
    - /templates
    - __init__.py
    - auth.py
    - db.sqlite
    - main.py
    - models.py

app.py builds the db

from project import db, create_app, models
db.create_all(app=create_app())

db is make with flask_sqlalchemy

db = SQLAlchemy()

def create_app():
    app = Flask(__name__)

    app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///db.sqlite'

    db.init_app(app)
#

Hopefully that helps @opaque rivet

#

Also it works fine on my Windows PC but not a Ubuntu docker container

opaque rivet
#

yeah that's strange ๐Ÿค” , I've never ran into that issue before and I don't see problems with the directory. I did come across this article which looks promising though:

edgy isle
#

I think I know how to fix this

#

The thing that is diffrent for me is on my local computer im trying not to deploy it while on my VPS I am trying to deploy it

#

And on my local computer I am just using Python to run it from the directory where app.py is and on the VPS I am doing its from within main.py's directory with gunicorn

#

I just changed my directory one up and did
gunicorn -b 0.0.0.0:5000 "project.__init__.py"
instead

#

and it works but new problem to solve that I will figure out a fix for

#

Now its saying models doesnt exist

#

Fixed it

native tide
#

Someone can help me with django?

#

I'm new at the language, soo i need help with this idea:

class test(models.Model):
    options = (
        ('Option1', 'option1'),
        ('Option2', 'option2'),
    )
    formOptions = models.CharField(max_length=255, choices=options)
    def whatYouChoose(self):
        if self.test == 'Option1':
            return models.CharField(max_length=255, help_text='You choose option 1, please write something bellow')
        else:
            return models.CharField(max_length=255, help_text='You choose option 2, please write something bellow')

When you choose some option, open some form for you fill what you need

#

But is this code who i wroted, didnt work (obviosly) someone can help me?

white spruce
#

need some help

#
2021-03-23T23:38:55.750464+00:00 app[web.1]:     return self.dbapi.connect(*cargs, **cparams)
2021-03-23T23:38:55.750464+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/psycopg2/__init__.py", line 127, in connect
2021-03-23T23:38:55.750465+00:00 app[web.1]:     conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
2021-03-23T23:38:55.750465+00:00 app[web.1]: sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) could not connect to server: Connection refused
2021-03-23T23:38:55.750465+00:00 app[web.1]:     Is the server running on host "localhost" (127.0.0.1) and accepting
2021-03-23T23:38:55.750466+00:00 app[web.1]:     TCP/IP connections on port 5432?
2021-03-23T23:38:55.750466+00:00 app[web.1]: 
2021-03-23T23:38:55.750466+00:00 app[web.1]: (Background on this error at: http://sqlalche.me/e/e3q8)
2021-03-23T23:38:55.752191+00:00 app[web.1]: 10.101.190.181 - - [23/Mar/2021:23:38:55 +0000] "GET /properties/ HTTP/1.1" 500 290 "https://obscure-plateau-19750.herokuapp.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
2021-03-23T23:38:55.762384+00:00 heroku[router]: at=info method=GET path="/properties/" host=obscure-plateau-19750.herokuapp.com request_id=21800e80-2fda-46b7-8052-cc9fb0f633f6 fwd="67.230.32.64" dyno=web.1 connect=0ms service=12ms status=500 bytes=539 protocol=https
#

After I deploy my app to heroku and try to view the database I am getting this error

#

Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

#

this was the initial error and I tried to do
from app import db
db.create_all()

#

but it wont work because of that error

#

any help would be appreciated, it's a flask app

heady iris
#

does anyone knwo hwo to fix the
OSError: [Errno 48] Address already in use
error?

#

idk if this will make diffrence but i use Pycharm

#

ping if anyone can help

wicked elbow
native tide
#

for some reason i have this code basically after using the collector 3 times it stops responding but for some reason it still responds. my friends and stuff tested it out and it works for them. this is my code: https://srcb.in/kAJuWGaSVE i added max: 3 on line 68 btw

Discord.js^

stoic tulip
heady iris
wicked elbow
heady iris
#

yes it seems to be that

#

and this is my frist time encountring smt like this

#

and im lost

wicked elbow
#

just start one on port 8080 instead

heady iris
#

im really sorry

#

but how?

wicked elbow
#

django is... python3(py) manage.py 127.0.0.1:8080

#

theres a similar command for all dev servers

heady iris
#

wait this is flask tho

#

or is it the same?

wicked elbow
#

default for flask dev is 5000. so you could probably also use port 8000 for it instead

heady iris
#

and after everything shoudl work?

#

cuz im getting same errors

wicked elbow
#

yea thats my guess

heady iris
wicked elbow
#

are you in windows?

heady iris
#

windows wdym?

wicked elbow
#

is this for production or developement? and what os are you on?

heady iris
#

im on macos Catalina

wicked elbow
#

trying to run production or development? and is that error being caused from opening flask?

#

sudo lsof -i -n -P | grep TCP run that in command line. itll show what ports are already in use

heady iris
heady iris
#

what am i trying to find?

#

id pressume the project itself?

#

im sorry if im really not pro at this

wicked elbow
heady iris
#

aight so both posts have teh exact same port but mine seems to be complety different and idk if that means anyhting

#

unless its just an example

wicked elbow
#

no, im just telling you to change the port of your flask app to one not in use. or kill whatever is on the port you need

quiet ridge
#

Do you feel that I can upgrade something

spare iris
#

@quiet ridge wow I thought this was impressive

inland copper
#

i am getting an error while pushing to github

#

can anyone help me?

quiet ridge
#

@spare iris thanks man but do you think I need something to change

#

@inland copper What is the error ?

inland copper
worldly garden
#

Hello, I'm learning django rest framework and I faced with a problem. In my models I have OneToOne relationship and I'm trying to serialize data, but I have a error:

#

Here're my models:

class User(models.Model):
    name = models.CharField(max_length=255) 
    password = models.CharField(max_length=255)
    birth_date = models.DateField(blank=True, null=True)
    contacts_number = models.PositiveIntegerField(default=0)
    creation_date = models.DateField(auto_now_add=True) 

    def __str__(self):
        return self.name

class Email(models.Model):
    email = models.OneToOneField(User, on_delete=models.CASCADE, primary_key=True)
    name = models.EmailField()
    is_activated = models.BooleanField(default=False)
    last_modified = models.DateTimeField(auto_now=True)

    def __str__(self):
        return self.name

My serializers:

class UserSerializer(serializers.ModelSerializer):
    class Meta:
        model = User
        fields = ['name', 'password', 'email']
    

class EmailSerializer(serializers.ModelSerializer):
    email_id = UserSerializer(read_only=True)

    class Meta:
        model = Email
        fields = ['email_id', 'name', 'is_activated']

And my view:

class UserRecordView(APIView):
    
    def get(self, request):
        users = Email.objects.all()
        serializer = EmailSerializer(users, many=True)
        return Response(serializer.data)
rotund wagon
#

Can i ask something about bootstrap here?

hexed perch
#

hey i am developing Django project how can i inform fronted(react) after any process is over?

#

like if Django get any input from fronted then it should process the information and when it is over then it should automatically notify the fronted?

tribal pewter
#

you mean sending an input from a form ?

hexed perch
#

no like for example i am giving some input data from front end, it goes to the backed and Django should start processing it and after the process is completed, it should ping the output to front end. like react should not wait until Django completes it work.

tribal pewter
#

Its not really clear what you wanna achieve; you're saying that Django should ping react after the process is completed but not wait for Django to complete

#

how is that

hexed perch
#

like i have one algorithm running in the django which take much time to complete and give output. so i want some thing that whenever django complete the executing the algorithm it should notifies the front end like "i have completed the process and this is the output."

vestal hound
#

you can also use WebSockets

#

for this case I would suggest SSE

wicked elbow
#

whats up gm aint seen you in a minute

vestal hound
#

work been hell

wicked elbow
#

i feel you. ive completely changed the look of my social media app since the last time you seen it. fixed a bunch of spacing issues and remeoved some ugly headers

wicked elbow
#

ok one sec

hexed perch
#

can you write the full form of SSE please

vestal hound
hexed perch
#

ok, thanks a lot

wicked elbow
#

@vestal hound newest version

vestal hound
#

uh

#

the gradient...

#

is quite...

#

1990s...

#

it does look better though

#

IMO

#

maybe vertically centre the "Suggested"

#

and add a bit more left padding?

wicked elbow
#

im working on putting a transparent gradient with an image for those

vestal hound
#

ah

#

okay

wicked elbow
#

was just messing around more then anything with that

#

i worked on the new posts for like 3 days off an on.

#

theres a menu too had to get all the links working

lament otter
#

Can we make django full stack web app on repl.it

#

ยฟ

worldly garden
opaque rivet
#

@hexed perch sounds like a simple API endpoint which you can use DRF for.

hexed perch
#

what is DRF? @opaque rivet

static basin
#

@quiet ridge what a lovely website!!

opaque rivet
#

@hexed perch django rest framework, it allows you to make APIs with django.

hexed perch
#

ya @opaque rivet i am using django rest framework

#

my question was, how can i make reverse api request like server to front end

opaque rivet
#

Oh yeah, that's websockets. Use django channels

#

But you could just use an API view if you want a singular response from the server, don't you think?

wraith pond
#

i have this code

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome(executable_path="F:/PyCharm/chromedriver_win32/chromedriver.exe")
driver.get("https://weather.com/en-IN/?Goto=Redirected")
sbox = driver.find_element_by_id("LocationSearch_input")
sbox.send_keys("k")
#

i want to get this elem

#
<input role="textbox" id="LocationSearch_input" data-testid="searchModalInputBox" class="SearchInput--InputField--232zz Search--inputClass--eGdhQ" type="text" placeholder="Search City or Postcode" autocomplete="off" autocapitalize="off" aria-describedby="SearchAccessibleHint" aria-autocomplete="list" aria-controls="LocationSearch_listbox" aria-multiline="false" dir="ltr" va="" value="g">
#

it gives me this error

#

raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
(Session info: chrome=89.0.4389.90)

heady iris
wicked elbow
heady iris
#

it works

wicked elbow
# heady iris it works

lmao it happens. if you dont succeed, always power off and power back on. thats the first step every single time with dealing with tech lmao

heady iris
#

i will def keep that in mind when i run into another non code problem

#

thx

opaque rivet
heady iris
#

huh

#

thats rly good to know

#

Thanks

quiet ridge
#

@static basin thanks

wicked elbow
hexed perch
#

ya front end will provide some initial data to server and then server will process.

wicked elbow
#

serious question, how many people use <UL> for links rather then <div> flexboxes? im just curious

hollow ingot
#

Hey guys, how should i go about streaming web cam in browser to my flask backend?

opaque rivet
#

@wicked elbow I use divs

iron wedge
#

hi

wicked elbow
mortal remnant
#

I'm currently doing a "poor man's" load test using while True: ... requests.get(). It works, but I would like more throughput. Is it possible to use aiohttp to do that? Or is multiprocesssing more appropriate/effective?

opaque rivet
#

Has anyone received external funding for their project/startup? I've come to that stage but I have no idea where to start.

quiet ridge
quiet ridge
mental crater
#

For a flask app, what's a way to do user email verification during signup?

stable hemlock
mental crater
#

Yeah, that

stable hemlock
stable hemlock
#

for example, you could send an email with a link to a page, then the user has to click a button on said page to confirm.

mental crater
#

@stable hemlock , awesome . this is what i was looking for ๐Ÿ‘

native tide
#

how to write text in a background image?

quiet ridge
#

@mental crater yoo can you flask mail and tokens

frank pawn
#
def ourmember(request):
    if request.method=="POST":
        username1 = request.POST.get("name")
        desc1 = request.POST.get("subject")        
        feedback.name=username1 
        feedback.desc=desc1
        feedback.save()
        return render(request,"email.html")  
    return render(request,"email.html")```--->is something wrong here as it is showing error save() missing 1 required positional argument: 'self'
opaque rivet
# stable hemlock What do you mean by "don't know where you start?"

I'm just unfamiliar with how people start startups, look for funding, etc. I've been really intrigued about it and was wondering if I could turn my original full-stack project into a startup business for funding. I've seen a similar business on ProductHunt with decent success.

I think my next step is to get some market research and maybe solidify whether the business is a good idea for investors or a startup ๐Ÿ‘

wicked elbow
wicked elbow
#

background-color: var(--dark-blue) fun fact. if you dont know how to do this, you should really learn it. i learned it today and would seriously have saved me a lot of time if i would have known about it a long time ago... anything that uses that var will change when you its value. so no hunting hex codes or rgbs down to change them

warm cape
shadow python
#

how can i add multiple episodes with the same anime name ? cause everytime i go create new episode i have to search for it

distant trout
#

im really confused, my code is giving me an index error on heroku but not on my actual machine

#

its just simple scraping with requests-html

noble smelt
opaque rivet
#

Then you can easily group each episode by the anime

shadow python
#

@opaque rivet thanks

opaque rivet
#

@wicked elbow found this cool "startup school" from YCombinator, thought I'd share ๐Ÿ˜„

wicked elbow
#

6 week class oh man

opaque rivet
#

yeah, i see it as a few videos here and there on backburner. i've really been getting into this "startup" idea recently. I've only made 2 projects and my most recent one was made as a business. but for the future, all the constraints of profit can go out the window and it can be focused on an ambitious startup plan.

#

drone startups are really intruiging to me, but they do seem a bit crowded imo

wicked elbow
#

why does it look so boring? ๐Ÿ˜ข

#

i just cant build a landing page to save me life it would seem. cant come up with something i like

wicked elbow
opaque rivet
#

i like the look, simplistic and nice

wicked elbow
#

to much of the dark blue. im just afraid of using images. feels like it takes away from what the site is. im not offering a product so nothing to display on the landing page. and since its not launched, cant use user submitted pictures or stats either. just one of those things

shadow salmon
#

Maybe add some svg patterns instead of plain colors. Add some visual variety.

ashen sparrow
#

guys how long does it take to update CNAME in yor domain?

#

I am trying to deploy my heroku app, I followed the docs, and added CNAME in my domain pointing to the value in Heroku dashboard. But it has still not changed, it is taking too long this time. I tried to use dns lookup tools online to see if my domain has the CNAME registered, bt it shows nothing I can interpret

royal tendon
tribal sedge
#

Can someone give me a decently easy website idea for me to make local host?

tribal sedge
vestal hound
#

which isnโ€™t necessarily bad

wicked elbow
vestal hound
#

honestly I think it looks fine

#

if you want you could maybe add a couple of screenshots of actual use of your site?

#

like scaled down

wicked elbow
quiet ridge
elfin sigil
#

hi, im tryna take a response and get an object from the json that gets sent back...
if i just use request.json.id i get this err:

AttributeError: 'str' object has no attribute 'id'

i have even tried using the json.dumps function but that didnt seem to work...

#

whats the proper way to do this?

wicked elbow
#

thats django anyways

elfin sigil
#

im using flask

#

lemme try that anyways

#

oh and

#

im facing another problom

#

im tryna host a flask server and a discord bot on the same process....

#

it jsutu doesnt seem to work

#

either the flask server runs or the discord bot

#

not both

rose vine
#

Hey guys I need one help, I don't know if it's a noob question or not
Can somebody tell me how to hide the secret key in django when uploading on GitHub as GitHub sends a email regarding it if your repo is public

elfin sigil
#

try using an env

rose vine
#

I did and added it to the gitignore

#

But still

prisma canopy
#

Hi

#

I need help

#

I have a dpubt about Flask, when i tried to add navbar and then ran it, navbar is looking weird, i also tried that in form, but it is looking in Blue lines, whats the reason?

#

Please ping if yoh know

wicked elbow
rose vine
native tide
#

can someone explain what django signals are used for?

prisma canopy
#

@gray creek

#

Hi

#

I have a dpubt about Flask, when i tried to add navbar and then ran it, navbar is looking weird, i also tried that in form, but it is looking in Blue lines, whats the reason?

gray creek
#

What does it look like?

#

Can you send a screenshot?

prisma canopy
#

Ah

#

Wait lemme check

gray creek
#

also this sounds more like a html/css question, rather than flask

prisma canopy
#

Yep

#

Bootstrap

#

Idk why

#

Sh** i need to turn on pc

#

Btw it is looking like hyperlinks

flat nacelle
#

hello

#

i want to add a img in my django template, somethink like: <img src="path to img"> any idea on how to do it

prisma canopy
#

Ping me when you come!

prisma canopy
#

I mean i was using navbar

#

It looks like this

#

I copied starter templete for bootstrap

#

And navbar code also from bootstrap

#

@tribal pewter

flat nacelle
tribal pewter
# prisma canopy

Something is wrong importing the CSS if you have everything imported right check your JS console to see if there is any error

prisma canopy
#

Nah

#

There wasn't any error

#

Only in my pc it is looking like this

tribal pewter
#

and a screenshot of your code would be very useful

prisma canopy
#

Not in others pc

prisma canopy
#

First starter templete of bootstrap

#

Then navbar code inside body

#

Whats the problem?

#

@tribal pewter

#

Should I have to download anything?

#

Please tell

tribal pewter
#

If you are linking to the bootstrap cdn then no you don't have to download anything

prisma canopy
#

No not cdn

#

I just copied starter template and then did nothing

tribal pewter
#

and what do you mean by 'starter template of bootstrap'

#

?

prisma canopy
#
<!doctype html> <html lang="en"> <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- Bootstrap CSS --> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" crossorigin="anonymous"> <title>Hello, world!</title> </head> <body> <h1>Hello, world!</h1> <!-- Optional JavaScript; choose one of the two! --> <!-- Option 1: Bootstrap Bundle with Popper --> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/js/bootstrap.bundle.min.js" integrity="sha384-JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9Ekf" crossorigin="anonymous"></script> <!-- Option 2: Separate Popper and Bootstrap JS --> <!-- <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.1/dist/umd/popper.min.js" integrity="sha384-SR1sx49pcuLnqZUnnPwx6FCym0wLsk5JZuNx2bPPENzswTNFaQU1RDvt3wT4gWFG" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/js/bootstrap.min.js" integrity="sha384-j0CNLUeiqtyaRmlzUHCPZ+Gy5fQu0dQ6eZ/xAww941Ai1SxSY+0EQqNXNE6DZiVc" crossorigin="anonymous"></script> --> </body> </html>
#

This is whole bad

#

But code looks like this

#

<!doctype html> <html lang="en"> <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- Bootstrap CSS --> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" crossorigin="anonymous"> <title>Hello, world!</title> </head> <body> <h1>Hello, world!</h1> <!-- Optional JavaScript; choose one of the two! --> <!-- Option 1: Bootstrap Bundle with Popper --> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/js/bootstrap.bundle.min.js" integrity="sha384-JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9Ekf" crossorigin="anonymous"></script> <!-- Option 2: Separate Popper and Bootstrap JS --> <!-- <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.1/dist/umd/popper.min.js" integrity="sha384-SR1sx49pcuLnqZUnnPwx6FCym0wLsk5JZuNx2bPPENzswTNFaQU1RDvt3wT4gWFG" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/js/bootstrap.min.js" integrity="sha384-j0CNLUeiqtyaRmlzUHCPZ+Gy5fQu0dQ6eZ/xAww941Ai1SxSY+0EQqNXNE6DZiVc" crossorigin="anonymous"></script> --> </body> </html>

gray creek
#

ctrl + shift + i

#

Then send a screenshot

prisma canopy
#

Not on pc

#

๐Ÿฅบ ๐Ÿฅบ

#

The output is like this

#

Blue lines

gray creek
#

The CSS is not loading

prisma canopy
#

What can i do to load it

tribal pewter
#

try doing
<p class="text-danger">some text</p>
and see what the output is

prisma canopy
#

Others can load succesfully

tribal pewter
#

otherwise idk how we could help you if you're not on your PC

prisma canopy
#

?

tribal pewter
#

you need to debug it and we can help with that but you cant debug without testing so yes a screenshot of your code would be somewhat useful

prisma canopy
#

Ok

#

html code

#

index.html

#

@tribal pewter

#

@gray creek

#

u here astros?

tribal pewter
#

that worked completely fine for me

prisma canopy
#

ss plox?

#

i also want to see

tribal pewter
prisma canopy
#

whywhywhwywhwhwhwhwhwhw

#

why doesn't for me

#

can you tell the reason why the css file is not loading

#

what can i do so that the file loades automatically

tribal pewter
#

<p class="text-danger">some text</p>

prisma canopy
#

where to add?

tribal pewter
#

add that to test if bootstrap is getting imported

prisma canopy
#

in the body?

tribal pewter
#

in the body

prisma canopy
#

only this code

#

?

#

or anything else cause i dont know html perfectly

tribal pewter
#

yes this wont solve it just to see if bootstrap is imported

prisma canopy
#

no

#

everything is like that before

#

same text and hyperlinks

#

anyother solutions?

tribal pewter
#

is this text in red?

prisma canopy
#

no

#

black

tribal pewter
#

can i get a screenshot of your page

prisma canopy
#

take it

#

and one more thing

#

i am on windows 7 32-bit

tribal pewter
#

ok right click anywhere on the page go to inspect than console and see if there is any error

prisma canopy
#

yeah

#

something isn't loading

#

bootstrap css file

#

yeah

#

what can I do so that it would load!

#

astrosssssss

#

ping me when you got the solution

#

@tribal pewter sorry for ping but you haven't replied

#

can anyone help me with this?

native root
#

err_name_not_resolved..

#

That's a DNS error

#

Check your system's dns setup/internet connection, those urls should load

elfin sigil
#

Iโ€™m trying to run a discord bot and a flask server at the same time

#

Only one of them seems to work at a time

#

I heard i have to thread flask....

#

How can i do that?

gray creek
#

make sure they're not running on the same port

prisma canopy
#

means?

prisma canopy
gray creek
#

I'm not talking to you

#

talking to @elfin sigil

native root
prisma canopy
#

ookay let me check

#

nah bro

#

not checking

#

@native root

#

not working*

#

any other solution?

native root
#

Something's wrong with your browser/internet

prisma canopy
#

my chrome lag so much

#

but i have tried on internet explorer too

#

its same

native root
#

loads instantly for me

#

means that either there's a typo in it (it looks copy-pasted, so it should be fine) or your internet is broken in some way

#

you can try fixing your DNS server settings

prisma canopy
#

yea

#

how

#

can you give me a tutorial

#

when i click on your link it showed that check if there's a typo in there

royal tendon
#

loads instantly for me too

#

is this on windows, mobile or?

#

also, if anyone is interested at all, I am looking for a project to work on to help me improve

#

so if you have any sort of, ideally Flask based, project that you wouldn't mind having someone work on or just to run some ideas/problems by me, feel free to PM

elfin sigil
royal tendon
#

taken current project as far as I can at the moment...trying to get some businesses using it, but otherwise need to start on something new

prisma canopy
#

please any otheer solutions

#

i dont wanna waste my more imt

#

time

#

3 days are wasted because of this

#

its solved

#

@native root you were right, my network was experinenceing some dns problems

native root
#

Sorry, got a little distracted with other stuff but glad you figured that part out

prisma canopy
#

yeah

#

thanks bro

#

i also fixed the dns problem

#

now i will start learning from tomorrow

#

thanks once again]

cloud path
#

guys how can i ban all characters but space and letters in a field of a flask form?

lusty solar
#

I need help with web design, legit got that task

#

As a homework

#

Im soo confused over what JS do. Anyone who could help?

#

What does that mean

spring raft
#

Hello Everybody, I am new to python, was trying to start web-dev in it. Can anybody show me the path where should I start from?

gloomy osprey
#

pls upvote if u cant help

lavish prismBOT
#

5. Do not provide or request help on projects that may break laws, breach terms of services, be considered malicious or inappropriate. Do not help with ongoing exams. Do not provide or request solutions for graded assignments, although general guidance is okay.

compact crane
#

Hello, how can I prevent users from watching white background for miliseconds before the DOM elements are printed when they get redirected to another template?

tribal pewter
patent ingot
#

Hello, I have a quick question:
I am trying to get rid of HTML in my request, here is the code:

req = requests.post('https://www.medicine-app.com', data=data)
log.error("debug request")
log.error(req.text)

req_json = req.json()

This is in my terminal:

debug request
{"text_answer":"You can go to your doctorโ€™s or get medical appointment for: <br><br><b>Orthopedic clinic</b> <br>Time: Your first appointment is in July 2021                          <br><br>","response_type":"procedures","data":"[{'name': 'YES', 'value': '1023; 8; 3'}, {'name': 'NO', 'value': 'reset'}]"}

When converting to JSON with req.json() last line I get this error:
JSONDecodeError('Invalid control character at: line 1 column 145 (char 144)')

gritty cloud
#

so apparently you are sending a post request to a full website?

#

@patent ingot

patent ingot
#

That website does not exist, I changed it to some example. Check my terminal..

#

I get that as a response

spring raft
patent ingot
#

I tried with line of code:


    req_json = req.json()
    req_json["text_answer"] = req_json["text_answer"].replace("<b>", "").replace("</b>", "").replace("<br>", " ")
#

But the same error

#

Maybe the problem is when it converts to json.

#

How can I get for req variable to fix the HTML, before I convert to JSON.

tribal pewter
#

And then slowly building projects and learning along the way

#

that's how I did it but you may prefer watching YouTube tutorials and there is plenty of them especially for Django

hollow sparrow
#

can we inc pixel size in pygame

#

??????????????????????????/

native tide
rocky ferry
#

someone please explain me why k='hello' k[0]=5 console.log(k[0])

#

i get no error when i try to change

elder nest
#

how would I start a quark website from a different file

native tide
#

Hello everyone, i want get a recommendations for name of my api endpoint
I made an api so that people can get information about the coronavirus vaccination. Before more people use it, I would like to choose good names for the resources, which they think about of the following:

I think in the next

Endpoint for get vaccination history of a country (dates and number of vaccinated that date)
api.covidvaccines.com/api/v1/history-vaccination/countries/:countryId
I think the "/api" is redundant because it is already in it. from the domain "api."

Endpoint for get available countries for make request in previous point
api.covidvaccines.com/api/v1/available_countries

Endpoint for get source of data
api.covidvaccines.com/api/v1/source-data/countries/:countryId

Endpoint for get history of vaccination all country today
api.covidvaccines.com/api/v1/history-vaccination/today

hardy stratus
#

Hi
My flask app works properly with http but when I try to run it with https using: flask run --cert=cert.pem --key=key.pem it returns 404 not found error for whatever page I request, tho they work with http. Static files are available tho. How to fix? Thanks
(code is way too big)

scarlet breach
#

i want to make a basic dashboard website for my discord bot, for this purpose which framework should i use? django or flask? (idk anything about web dev)

native tide
#

And simpler

scarlet breach
#

oh aight thanks a lot

wooden ruin
scarlet breach
#

i want something that i can make as am learning a framework if that makes sense, some website that has the potential to grow as my skills grow in a way

#

maybe i can switch from flask to django midway or is that not possible

quick cargo
#

not really

#

they're two very diffrent styles

#

doesnt really matter what you pick

#

just go with one

#

both have massive ecosystems

stable hemlock
scarlet breach
#

oh aight ill start out with flask since its easier for a beginner? then eventually learn django

stable hemlock
scarlet breach
#

thanks!

fierce ridge
#

is anyone have project for me my expertise on ReactJS, PHP, Laravel and wordpress

shell spear
#

Why is Heroku free and not ask for credit card information but Web services like AWS and Digital cloud ask for credit card information

stable hemlock
# scarlet breach oh then ill use django because it is working with my bot in a sense

This one part of a seven part video tutorial that I followed for the start of my bot dashboard. https://www.youtube.com/watch?v=l9HRpFWzDQQ

Want to support me and the channel? Donations are not required but greatly appreciated!

Become a Patreon: http://patreon.com/stuyy
Buy me a Coffee: http://ko-fi.com/anson
Streamlabs: https://streamlabs.com/ansondevacademy/tip

Discord Server: http://discord.gg/bZSwjPy
GitHub: http://github.com/stuyy

โ–ถ Play video
stable hemlock
native tide
#

do you guys know the reason why the img location is unknown?

#

apps

broken frost
#

Hi! Me and my friends were trying to make a website that has information about various online courses. The user can filter the courses based on the tags difficulty level etc. For doing this, we need APIs of online education platforms to make use of their data. We tried but could only find Udemy API. Can someone pls provide any good APIs of online education platforms

mortal pike
#

Hey guys, if you could take a look at my django question in #help-pie that would be great! (Please help, I have been stuck on this for the past hour and a half)

forest vapor
#

Guys, can you help me to choose framework for aws deploy serverless(mostly) applications by python!?

scarlet breach
balmy elbow
#

Hello

#

anyone here?

native tide
#

why do i have this

#

rather than this

tepid lark
#

Are you using bootstrap?

native tide
#

yes

#

@tepid lark

tepid lark
#

There's a lot that could be going on, compare your markup to the example I guess?

#

I think the boostrap docs have code samples.

native tide
#

@tepid lark

tribal pewter
#

well first it should be class not className

native tide
#

i have react

tribal pewter
#

ah nvm

native tide
#

figured it out

primal grove
#

@royal ibex This is the place.

opaque rivet
royal ibex
#

Hey all, I'm having some trouble with the built in Django Admin tools, specifically the database tools

#

Right now, it shows the entries in the database just fine, like so:

#

But when I click on any of the entries, or click on add Ingest_File, I get this screen:

#
models.py

from django.db import models


# Create your models here.
class Ingest_File(models.Model):
    orig_file = models.CharField(max_length=40)
    pd_index = models.CharField(max_length=10)
    ddn_oid = models.CharField(max_length=40)
    file_name = models.CharField(max_length=50)
    creation_date = models.DateTimeField('creation_date')
    ingest_date = models.DateTimeField('ingest_date')
    hash = models.CharField(max_length=32)
    file_path = models.FilePathField(max_length=500, null=True, blank=True)
    ingest_path = models.FilePathField(max_length=500, null=True, blank=True)
    file_ext = models.CharField(max_length=15, null=True, blank=True)
    file_size_bytes = models.CharField(max_length=15)

    def __str__(self):
        ret = self.orig_file + " " + self.pd_index + " " + self.ddn_oid + " " + self.file_name
        return ret
#
admin.py

from django.contrib import admin

# Register your models here.
from .models import Ingest_File

admin.site.register(Ingest_File)
primal grove
#

@royal ibex just so we're on the same page, do you see how the error message is telling you that the path you passed to it in an empty string?

royal ibex
#

Yes, I'm just unsure of how the admin infrastructure is set up internally. It should just work, Django autogenerates these forms cause of its database functionality

#

I haven't changed the location of the sqlite file so I'm just like. what do

primal grove
royal ibex
#

Nah pycharm did tell me that

primal grove
#

And yet you did not listen ๐Ÿ˜ข

#

anyway, the empty string. Is that what the __str__ method from Ingest_File is returning?

#

like where is this empty string coming from?

primal grove
royal ibex
#

The empty string I believe is supposed to be the path to the object?? Maybe???

#

__str__ is just what that blue text is displaying for each object

primal grove
#

is it supposed to represent a file, and your goal was for the __str__ method to return a path to it?

austere acorn
royal ibex
#

It's supposed to represent an object in a database file stored on the server. I think the problem must lie somewhere in the way my model is set up that's preventing the form from being generated

austere acorn
#

why does this command open two node shells and doesn't install express ? it worked yesterday

opaque rivet
#

A web-based design tool to generate unique SVG design assets for websites, social media, blog posts, desktop and mobile wallpapers, posters, and more! Our generators let you discover, customize, randomize, and export generative SVG design assets ready to use with your favorite design tools.

#

svg generator

shadow python
#

can someone help me with something in django?

toxic flame
#

Sure

proud crow
#

Hopefully this is the right place to ask this since it's more of a topical question than code help
I'm pretty new to making web apps (not new to python in general), I'm working with Flask to make a web page that will eventually have an AI model that generates replies to user input, think a simple chatbot
I'm trying to get my code pushed up onto a heroku app to test things (was suggested to try Heroku but if there's other services better fit for this lemme know), but I'm having an issue related to the file system there

#

the AI model is ~1.5GB, which is well above the seemingly 500MB limit to heroku's file system for apps, and in general I'm reading that you shouldn't even upload stuff like that to Heroku to begin with

#

so...what's the alternative to doing that? I'm not sure how I'd have everything communicate properly still if the AI model is stored somewhere else separate to the scripts on heroku, let alone knowing where to store it

I'm glossing over a lot of detail here but I can be much more specific about the project if needed, just don't want to flood the channel in case it's not the right place ๐Ÿ˜…

quick cargo
#

Having a ai on heroku in the first place is a bad idea

#

Unless you're paying for those beefy dynos they have no where near the amount of power to be reasonably useful at hosting that

#

In reality you want a actual vps rather than a free host provider like that

proud crow
#

are there free vps things that would work for this or would I most likely have to pay? this is for a capstone project for my master's degree and I'm on a grant so they'd probably be willing to pay for it if that was needed

#

worst case I don't think it'd be a big issue to just work on it locally and deal with deploying it to an actual service later down the road

simple niche
#

hi. What's the simplest way to make a web page that reads a .txt file uploaded by the user, and then gives you back a modified text file? either displaying it in a textbox or something like that or by asking the user to download the modified file

simple niche
#

I don't know where to start but I feel like it should be fairly easy

stable hemlock
stable hemlock
vestal hound
#

you could consider AWS SageMaker

surreal finch
#

Hello
I need a little help,
Can anyone tell me How can I send data from python file to the HTML page in Flask and vice versa?
So basically my aim is to take input from user in html text box,
send it to a neural network and print the output in the HTML on click of a button

serene prawn
surreal finch
#

Actually I needed both

#

I also found the solution

zealous olive
#

Hello dear awesome developers. I want to Delete, Edit, List, Search and create new data from the database. Then i want to display the output. How can i Connect the database to my HTML Form? If you have any tips, references, videos, anything that can help it will be much appreciated.

serene prawn
surreal finch
# surreal finch I also found the solution

1 - code a simple form to collect user input
2 - code a controller in Flask to receive the information (requests.form[โ€˜name of input text fieldโ€™])
3 - Code the communication layer with ML
4 - send back the response to the user (render_template)

zealous olive
serene prawn
#

You probably can't do that within single form ๐Ÿ˜‰

zealous olive
#

I do not want to do that within one single form

#

i have made a different page for single steps

#

the main problem is connecting database to the forms

serene prawn
#

Are you using any framework?

#

For backend

zealous olive
#

no sir

#

only pure python

serene prawn
#

Consider using django or fastapi

#

That would be a pain to do in plain python without any frameworks or libraries

marsh canyon
#

or you can also have a database hosted somewhere and connect with it using javascript

marsh canyon
#

but I would say a framework is what is required

serene prawn
#

Just... a bad idea

marsh canyon
#

ye..

#

just hinting at all the possible options

zealous olive
marsh canyon
#

there should be a tutorial on the website

serene prawn
#

There is

#

right on docs page

zealous olive
#

Thank you two. I preciate the immediate help. Have a good one guys! cheers.

marsh canyon
#

before that

#

you should look at how wed dev works

#

I mean, learning about what is frontend and backend

#

cuz django is a backend

serene prawn
#

@marsh canyon Btw are you familiar with django? ๐Ÿค”

marsh canyon
#

like a brief introduction of web dev

#

yes

zealous olive
serene prawn
#

How should i go about creating services in django compared to say laravel?

marsh canyon
#

I am not sure how laravel works

#

but do you mean REST APIs?

serene prawn
#

No, literally services inside of the app itself

#

Say i want to proxy another api via django

#

So i need say to store that api's session token, make http requests from django itself, etc

#

And i have to get that token first ๐Ÿ˜…

#

via login/password pair

marsh canyon
#

how are you geting the token?

#

GET request to that api?

serene prawn
#

yep

#

just an http request

#

with login/password attached

marsh canyon
#

so whats the problem after that?

serene prawn
#

I have to store it somehow because it can expire ๐Ÿค”
Plus i might have a lot of service objects for different purposes

#

And they all have to attach token to the request

marsh canyon
#

you can make a db model for that I guess

#

or store it in cache

#

redis ?

serene prawn
#

I think even file cache will do?

marsh canyon
#

yea I guess, but no a big fan of those

serene prawn
#

I can swap them anyway, right?

#

So no big deal

#

But anyway how do i encapsulate my logic?

#

So i don't do all that stuff in views

marsh canyon
#

you can have tasks

#

periodic tasks

#

or background functions

serene prawn
#

I mean

#

I want to have say PostsService with different methods defined for say storing/retrieving posts from an api

#

So logic stays in one place

#

๐Ÿค”

#

Just where do i store business logic ๐Ÿ˜…

marsh canyon
#

what is business logic

serene prawn
#

Any application logic

marsh canyon
#

how is it triggered?

#

when does the application logic need to be called

serene prawn
#

It can be called literally anywhere i guess

#

Most commonly in views ๐Ÿค” if i stick to an example with api

quick cargo
#

You're gonna get a bonk if you're storing those passwords in plain text instead of hashing them angryeyes

quick cargo
#

with login/password attached

serene prawn
#

It's an API key/password

#

Not to my api...

quick cargo
#

I would recommend either jwt authorization for this or oauth2

#

Ah

marsh canyon
quick cargo
#

Then ignore me

serene prawn
#

So to the .env they go

marsh canyon
#

if its something that needs to run periodically, then just background tasks, like cornjobs on linux

serene prawn
marsh canyon
#

eh, I am not sure what that means, but if it seems right to you and works, go ahead

serene prawn
#

๐Ÿ˜…

#

I'm just curious, i have to work at my job with laravel and i hate it )

marsh canyon
#

๐Ÿ˜ฌ

serene prawn
#

@marsh canyon I guess i can have a class, like ApiServiceBase and make a something like session property that will return a requests.Session object ๐Ÿค”
with headers attached

#

For that api ๐Ÿ™‚

native tide
#

can someone please help me this is my code ```python
from flask import Flask, Blueprint
from main.start import index

app = Flask(name)
app.register_blueprint(index)

@app.route("/")
def test():
return "why"

if name == "main":
app.run(host="0.0.0.0", port=80, debug=True)``` <- that is app.py

#
from flask import Flask, Blueprint

index = Blueprint('index', __name__)

@index.route('/test')
def index():
    return "This is an example app"```
#

the error i get is python Traceback (most recent call last): File "/Users/namorahimi/Projects/Python/Social-Network/app.py", line 5, in <module> app.register_blueprint(index) File "/opt/homebrew/lib/python3.9/site-packages/flask/app.py", line 98, in wrapper_func return f(self, *args, **kwargs) File "/opt/homebrew/lib/python3.9/site-packages/flask/app.py", line 1156, in register_blueprint if blueprint.name in self.blueprints: AttributeError: 'function' object has no attribute 'name'

#

i fixed it i got it

#

changed the function name

native tide
#

can someone explain this

#

reverse and redirect

dawn silo
# native tide

Where are you importing reverse from and which framework are you using?

native tide
#

views.py class PostUpdateView(UpdateView) and PostCreateView(LoginRequiredMixin, CreateView)

#

I just need the explanation of the use of reverse and redirect

stoic tulip
#

Which website is perfect for learning of HTML CSS BOOTSTRAP JAVASCRIPT?

serene prawn
stoic tulip
#

What??

serene prawn
#

What is your question exactly?

stoic tulip
#

Which website for learn ?

serene prawn
#

You want to create a website or learn these technologies on a website?

#

Oh, just use anything you find suitable for you

#

books, youtube

stoic tulip
#

But suggest me

serene prawn
#

It depends on what you want to learn

#

You would have to practice anyway so think of a project you can make

opaque rivet
#

codecademy

tribal sedge
#

How do you handle events in JS and HTML, because the way I tried to do it everyone says not to do it that way...

teal rapids
#

Hello! I am working on a Django/Apache+mod_wsgi website. I was able to create an ssl certificate for https. For now, one virtualhost still works on http (planning to redirect all http requests to https), another one listens port 443 for https requests. Thing is, while the http keeps working even while updating files (e.g. the templates), the https work on an older version (a few days old) and doesn't seem to keep up with the edits... any suggestions?

tribal sedge
# opaque rivet how did you do it?
<!DOCTYPE html>
<html>
  <head>
    <title>???</title>
    <style>
      body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
      }
    </style>
    <script type="text/javascript">
      function myFunction() {
        var d = new Date()
        var n = d.getTime()

        document.getElementById('current-time').innerHTML = n
      }
    </script>
  </head>
  <body onload="myFunction()"> <!-- This is the event -->
    <h1>???</h1>
    <p>This is the current time.</p>
    <p>
      <u>
        <i>
          Current Date and Time is
          <span id="current-time"></span>
        </i>
      </u>
    </p>
  </body>
</html>
opaque rivet
#

I don't see an issue with that, except for the variables not being explicit.

tribal sedge
opaque rivet
tribal sedge
#

Ah ok

limber laurel
#

I am using djangoand I am trying to redirect to y homepage opn 404, but for some reason my handler404 is not called and I get the default 404 screen

#

and I have even tried switching the handler to 500

#

but that also doesnt get called

#

waht could be causing this?

native tide
limber laurel
#

I am

#

does it only work in production, if yes, how can I test it in debug to see if the view works? @native tide

native tide
#

I cant explain properly so just watch this

limber laurel
#

oh, thank you very much

nimble epoch
#

anyone uploaded file on reactjs to django serializer i need help with it i cant upload image i think django serializer doesnt let me do that i already done that without image and it worked so the file field is the problem. should i use some extra libraries or something.

dawn silo
summer egret
#

Hey Guys

#

I wan to develop a LMS in django

#

*want

#

Can someone recommend me some good repos which I can start with?

elder jackal
#

guys can anyone advice a jsonrpc-client

idle apex
#

i don't know why my form isn't sending data back

elder jackal
idle apex
#

wait let me check devtools

elder jackal
#

you do app.run(debug=True) so you should see some logs in the app

#

your app won't return anything if you request nothing

idle apex
#

checked devtools

elder jackal
#

xD

idle apex
#

i don't think the request went through

elder jackal
#

what did the server say?

idle apex
#

that's just bootstrap stuff

idle apex
elder jackal
#

yeah

idle apex
#

csfr token, one 404 and two 200s

elder jackal
#

ok it means your stuff doesn't get rendered

idle apex
#

the form?

elder jackal
#

ye

idle apex
#

how should i get it to render

elder jackal
#

try to debug yourself, do

render_template("index.html", title="Search", form=form)

in a separate file (debug session)

#

check what it is returning

idle apex
#

nothing

#

wait how do i debug a single line

elder jackal
#

you cant

#

do imports and stuff

idle apex
#

what should be in my debug file

#

a route and a function with just the return in it

elder jackal
#
from flask import render_template
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField

class SearchForm(FlaskForm):
    term = StringField(label=('Search for:'), validators=[DataRequired()])
    submit = SubmitField(label=('Search'))

form = SearchForm()

variable_to_debug = render_template("index.html", title="Search", form=form)
native tide
idle apex
#

@elder jackal sorry had to step out for a while

#

RuntimeError: Working outside of application context.
This typically means that you attempted to use functionality that needed
to interface with the current application object in some way. To solve
this, set up an application context with app.app_context(). See the
documentation for more information.

elder jackal
#

add after import

app = Flask(__name__)
app.app_context().push()
elder jackal
#

thats why you'll see the empty page

opaque rivet
native tide
opaque rivet
#

Yeah that's what I was trying to suggest ๐Ÿ‘

obtuse matrix
#

ok

past cipher
#

Even if I print each item, it prints 5. But only adds once. Is the session not persisting through each table? I thought it did?

native tide
#

how to use overflow: hidden outside of a body{}?

opaque rivet
#

@native tide ? What do you mean by that

native tide
#

it deosn't seem that i can use overflow:hidden outside out of a body{} like a class div

opaque rivet
#

Not sure what you mean by body{}. All of your HTML goes within your body tags or it will not be in the DOM.

You can apply that CSS rule to a class in CSS like:

.class_of_element {
   overflow: hidden 
}
#

@nimble epoch nope, you send the form data with enctype multipart/form-data and you're able to access the file via request.FILES

native tide
#

what is a class of element?

opaque rivet
native tide
#

oh you mean that, i tried putting overflow: hidden; in the main div it doesn't seem to work

opaque rivet
#

Have you tried to inspect element to ensure that you selected the right div?

native tide
#

i have a scroll-snap so i basically did
body {
overflow-y: hidden;
}
.divcontainer {
scroll-snap-type: y mandatory;
overflow-y: scroll;
display: block;
height: 100vh;
}

i tried wrapping it with a div and replacing the body but it doesn't work

#

@opaque rivet

mint hedge
#

Anyone have a good easy to follow flask/Ajax tutorial?

native tide
#

Which text channel would be best to ask about Amazon SES service via Boto3?

vestal dove
#

How can I run a flask app & a discord bot at the same time? In other words, how do I do multiple tasks at once?

bot_is_on = True

while bot_is_on:
    client.run("token")

    if __name__ == "__main__":
        app.run(debug=True)

This is my current code. However, the bot runs and the website doesn't. When I do ctrl + c the bot goes off while the website runs.

native tide
#

does client.run hold the program flow?

native tide
swift wren
#

hey guys, i want to know how i can make bootstrap cards move on their own. so basically i have these cards right, and im using django to have a for loop and the amount of things Django returns is th amount of cards that are created right. so basically, if my database has 3 items, Django is going to create 3 cards, but right now it will only be created by going down. how can i set parameters to where the cards are pushed. because i want to first: check if the cards are approaching the bottom of the screen and then secondly: check if the cards are overflowing to the right. how can i add those 2 parameters to the the html so that the card divs can be placed appropriately to the resolution of the window

#

can you please ping me if you have a input, thank you

rich talon
#

Hi is this where I can ask about Python Dash?

nimble epoch
#

but still doesnt work

#

you mean instead of event.target.value, event.target.files[0].name, right?

native tide
#

@mint hedge I haven't tried it, but Miguel Grinberg's Flask Mega Tutorial has a chapter on AJAX, which could be a good starting point.

steep island
#

is anyone here .......

native tide
#

I'm trying to write my own web server

import socket

SERVER_HOST = '0.0.0.0'
SERVER_PORT = 5454

server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
server_socket.bind((SERVER_HOST, SERVER_PORT))
server_socket.listen(1)
print('Listening on port %s ...' % SERVER_PORT)

while True:    
    client_connection, client_address = server_socket.accept()
    response = 'HTTP/1.0 200 OK\n\nHello World'
    client_connection.send(response.encode())
    client_connection.close()

It doesn't give me error in the console, instead I get "Connection was reset" in my browser(FireFox)
Does anyone know why I get connection was reset error?

marble spade
#

Hello Helper! I am currently having an issue with Django! I have started to make a stock portfolio website and am having trouble with the following:

  • I can't send the data to the views.py file! I am trying to get input from a user in a HTML file and then convert it tl the views.py file.

The following code is what I have tried:
HTML CODE

<input type="text" name="stock_type" placeholder="Stock please..." class="username_class"><br> #Input box
<input class="submit" type="submit" name="UserCreate"><br><br>
#Submit button``` 
**Views.py CODE**:
```py
def home(response):
    stock_has_been_selected = False
    def damn(request):
        print("hi")

Any help would be appreciated!!!

tribal pewter
marble spade
#

hmm

tribal pewter
#

and in your views you should put

if request.method =='POST':
  stock_type = request.POST.get('stock_type') # Just put the name of whatever input you are sending
marble spade
#

@tribal pewter I added the following and got this error:
The view main.views.home didn't return an HttpResponse object. It returned None instead.

def yeetman(request):
    if request.method =='POST':
        stock_type = request.POST.get('stock_type') # Just put the name of whatever input you are sending
    ```
#

and I added the token

tribal pewter
#

is this all you have in this views

marble spade
#

no I have alot

tribal pewter
#

you should add the return render(your template) outside the if statement

marble spade
#

don't die on me because this code is pretty ass

#

but here

#

@login_required(login_url='/loginpage')
def home(response):
    stock_has_been_selected = False
def yeetman(request):
    if request.method =='POST':
        stock_type = request.POST.get('stock_type') # Just put the name of whatever input you are sending
    
    #Code for open, simplifed and cut down to 8 decimal places and no brackets.
    if stock_has_been_selected == True:
        my_share = share.Share('TSLA')
        symbol_data = None
        data = my_share.get_historical(share.PERIOD_TYPE_DAY,0,share.FREQUENCY_TYPE_DAY, 1)
        open_price = str(data['open'])
        open_price = (open_price.replace('[', '').replace(']', '')[0:8])
        close_price = str(data['close'])
        close_price = (close_price.replace('[', '').replace(']', '')[0:8])
        high_price = str(data['high'])
        high_price = (high_price.replace('[', '').replace(']', '')[0:8])
        low_data = str(data['low'])
        low_data = (low_data.replace('[', '').replace(']', '')[0:8])

        context= {
            'open_data': open_price,
            'close_data': close_price,
            'high_data': high_price,
            'low_data': low_data,
            }
        return render(response, "main/home.html", context)
    return render(response, "main/home.html", {})
tribal pewter
#

you get the error when submitting the form or when trying to access the page?

marble spade
#

access the page

tribal pewter
#

so replace all you response with request

marble spade
#
@login_required(login_url='/loginpage')
def home(request):
    stock_has_been_selected = False
def yeetman(request):
    if request.method =='POST':
        stock_type = request.POST.get('stock_type') # Just put the name of whatever input you are sending
    
    #Code for open, simplifed and cut down to 8 decimal places and no brackets.
    if stock_has_been_selected == True:
        my_share = share.Share('TSLA')
        symbol_data = None
        data = my_share.get_historical(share.PERIOD_TYPE_DAY,0,share.FREQUENCY_TYPE_DAY, 1)
        open_price = str(data['open'])
        open_price = (open_price.replace('[', '').replace(']', '')[0:8])
        close_price = str(data['close'])
        close_price = (close_price.replace('[', '').replace(']', '')[0:8])
        high_price = str(data['high'])
        high_price = (high_price.replace('[', '').replace(']', '')[0:8])
        low_data = str(data['low'])
        low_data = (low_data.replace('[', '').replace(']', '')[0:8])

        context= {
            'open_data': open_price,
            'close_data': close_price,
            'high_data': high_price,
            'low_data': low_data,
            }
        return render(request, "main/home.html", context)
    return render(request, "main/home.html", {})
#

like that?

tribal pewter
#

yes

marble spade
#

returns same error

#

The view main.views.home didn't return an HttpResponse object. It returned None instead.

tribal pewter
#

try adding a return in the if method ...

marble spade
#
if request.method =='POST':
        stock_type = request.POST.get('stock_type') # Just put the name of whatever input you are sending
        return render(request, "main/home.html", {})
#

thaT?

tribal pewter
#

ye

marble spade
#

same error ๐Ÿ˜ฆ

tribal pewter
#

can i get a ss of your code

marble spade
#

yeah

#

the HTML or python

tribal pewter
#

and try removing the if method ... does it solve it?

#

your views

marble spade
idle apex
marble spade
#

no it doesn't solve it

#

ah i'm an idiot @tribal pewter

#

I didn't return the home function

#

no more errors xd

tribal pewter
#

Oh yes ๐Ÿ˜…

marble spade
#
if request.method =='POST':
        stock_type = request.POST.get('stock_type') # Just put the name of whatever input you are sending
        print(stock_type)
#

still doesn't exactly work

#

submits and everything works

#

just doesn't print it

tribal pewter
#

Add an action to your form where it returns to the url of yeetman views

marble spade
#

uh