#web-development
2 messages ยท Page 143 of 1
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
Imo you can compare react and angular to (flask/fastapi) / django
even tho its lik 2 commands, the amount of files it downloads is jsut horrific.
really?
They're all cool but angular and django come with batteries
NOT NULL constraint failed: MyServer_links.redirect_url
flask would be react right?
Yep
no flask is backend react is front end....
jinja is nothing like react
...
It's not that hard, plus i personally love ts
really?
CS rendering is was diffrent than SS rendering
We're comparing different things ๐
Not cs and ss rendering
its legit a abstract comparision are you lot alrigh?
pls help me
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
Leaving a column blank on the db insert (redirect_url is apparently null when it's not allowed to)
yeah that seems correct
line 82
nah bud, if you have a not null constrain on your field, then if you left it empty its gonna cause issue
flask django dont compare to react at all... angular either for that matter. front end vs backend data manipulation.
wdym
yeah they do
#databases is more suited for this
flask is a library, django is a framework
Errr not quite
its mysql, its web based im pretty sure
Ehj?
no... flask and django are both just like php and asp
@quick cargo i am using dbsqlite3 is there i have to correct somehing
they are backends... thats all they are
no shit bro are you high?
go and carefully read what was written
you are missing the point
no im not... your comparing apples to oranges
@serene prawn help pls
???
Pretty sure it's you dojng the request.get()
That key wont exist in headers
So it's returning null
What happened ๐
Man's arguing that flask and every other micro framework isnt a framework
wha??
As well as Mysql apparently being web based ๐คฃ
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
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
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
If author calls it a framework then it is a framework ๐
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 
Flask is just a router with extra whistles though
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
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
Django has built-in protection ๐
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.
I mean that depends on what you're doing, if its ecommerce sure
But not everything works as well im django's world
For api i would choose FastAPI or Django if i feel lazy ๐
even if you want to make a scalable app, django would be faster
Sorta?
but if you want 100% control over your application then django will fail you
Most large companies which hav3 dynamic frontends go with flask for that
Unless you're ecommerce
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
what is the difference between a eCommerce app and a normal webapp
The things is... You can't have state with server side rendering
Technically you can but it's not applicable for ui elements
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
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
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.
I wasn't talking about rendering js apps in backend but compared say django templates with js frameworks in general...
if your talking server side redirection your wasting your time with a framework anyways. defeats the whole purpose of react/angular speed of delivery
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.
Django templates doesn't give you the freedom of JS frameworks. that's what i was talking about...
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.
I can't imagine dealing with even small that have any interactive elements without js frameworks
I tried all popular js frameworks - React, Vue and Angular
I would say that i'd go with Angualr
Im the same but im on team Vue
Angular ๐ญ ๐ญ
As much as i like reacts ease of use styled components kill me
?
I have angular prejudice I'm sorry
I like most of angular's stuff but couldn't quite get used to the communication between components
Well, you do that through parent component, like in react/vue or through service ๐ค
Basically can act the same as store in other frameworks
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
yeah but even then, if its a run time, why do people use it along side express
Request.post.get
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
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
but then there is no need for express
Maybe he would write an api for that react app using express?
cos cant raw node.js do the exact same thing that express does
It can, but it would be a pain ๐
really? man there are so many tangents in js.
There's no built-in routing or something
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
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??
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 ?
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?
Your react app would be bundled and served as .js file by flask itself or by another webserver
For development you can use react server
Field is a class from FastAPI, ellipsis (...) means that that parameter is required
Actually it can be just a function or anything but the main point is that it provides metadata for your model field
@coral raven
https://fastapi.tiangolo.com/tutorial/body-fields/
FastAPI framework, high performance, easy to learn, fast to code, ready for production
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
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
@distant trout You can't "put" data in your view if you already sent it to the client
cant i asynchronously load it in?
Not really... If you already sent view to the client then how would you put your data in it? ๐ค
i see sites do the loading spinning thing when a data is taking long to load
Consider using cache/javascript requests on frontend
Yeah, that's done with js
Usually with some js framework
oh u think i can do it with react
angular is my personal favorite though ๐
But it uses typescript so it can be hard to start with it
@distant trout Also if you're just starting or your backend is pretty small look into FastAPI
i heard that framework is much faster than flask
ahh
But they're pretty similar and fastapi makes a good use of python type hints
i see.. okay ill look into fastapi
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
according to techempower tests it's faster ๐ค
Ignore tech empower for anything other than the bench marking game of who's framework pipelines better 
๐
they're very miss leading benchmarks for the real world
Anyway fastapi is objectively better
I mean im not dis-agreeing that FastAPI is awesome for API's
its definitely my go to
apparently fastapi uses ASGI and flask uses WSGI
yes and?
They're pretty similar, have similar performance, and fastapi has more features than flask
they're just different server interfaces for asyncio and not asyncio
Is there any reason to use flask anymore? ๐
The eco system support, testing support general performance and ease of scalability
better stability under high load
if u had to pick a framework for a simple api, would it be flask or fastapi
FastAPI just because speed of setup
How do i call foreign functions from c++ or is there a module for relating with assembly code.
Oh okay, which is the correct channel to ask
Thanks
np
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?
from flask import Flask, render_template
return render_template('home.html')
why isnt this rendering
its saying invalid syntax
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
you can pretty easily fit that in a single VPS
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
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
Do this page will look good as my landing page ?
That looks cool
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
I'd suggest learning basic HTML and CSS
And from there, move to learning JS and a python framework, such as Flask
thanks
come stai
huh?
is it responsive? does it look good on mobile? also speed up your animations. nobody wants to watch animations when visiting a site after the first view. quick 200ms-250ms interactions or less. cool idea though
okay friend and this site is fully responsive
Refer to the docs?
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
yeah
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
what is the product?
does anyone have a coding website that i can use that has python on it?
looks good but theres no product anywhere which could be confusing
well dude this just a template and I was just checking if I can implement on my main website
I m working a community for programmers
nice
so making some simple templates for my programmer clients ๐คฃ
how many projects until you start looking for django fullstack jobs? ๐ค
When I use ||from django.urls import path, include|| it doesn't work, I am using repl.it, any ideas?
Dont think finding a job is that hard
like maybe one or two projects just to show your skills if im right
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
there's no file db within the parent directory of main.py
Thats not the full file directory, I went to edit it and when I hit shift+enter my Discord crashed so let me repost the file directory rq
- 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
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:
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
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
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?
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
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
what are you doing that caused it
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^
Where to start learning?
.....
ill be honest idk really
lmao sounds like a port issue. like if you tried to start 2 services on the same port. for instance node.js on 8000 and django dev server on 8000 as well
yes it seems to be that
and this is my frist time encountring smt like this
and im lost
just start one on port 8080 instead
django is... python3(py) manage.py 127.0.0.1:8080
theres a similar command for all dev servers
do this where you start your server
if __name__ == '__main__':
app.run(host='0.0.0.0', port=8080)
default for flask dev is 5000. so you could probably also use port 8000 for it instead
yea thats my guess
are you in windows?
windows wdym?
is this for production or developement? and what os are you on?
im on macos Catalina
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
idk what teh 2 things are and the error is caused when i run teh project
i see
what am i trying to find?
id pressume the project itself?
im sorry if im really not pro at this
here follow this. seems like its your issue. although its for ubuntu i think https://medium.com/@ishaileshmishra/the-python-flask-problem-socket-error-errno-48-address-already-in-use-4d074847587e
You already have a process bound to the default port (8000). If you already ran the same module before, it is most likely that processโฆ
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
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 wow I thought this was impressive
@spare iris thanks man but do you think I need something to change
@inland copper What is the error ?
error: src refspec main does not match any
error: failed to push some refs to 'https://github.com/KrishnaKanth1729/Newspaper
.git'
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)
Can i ask something about bootstrap here?
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?
you mean sending an input from a form ?
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.
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
SSE
server-sent events
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."
whats up gm aint seen you in a minute
work been hell
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
show me
ok one sec
can you write the full form of SSE please
server-sent events
ok, thanks a lot
@vestal hound newest version
uh
the gradient...
is quite...
1990s...
it does look better though
IMO
maybe vertically centre the "Suggested"
and add a bit more left padding?
im working on putting a transparent gradient with an image for those
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
Did anyone have such a mistake?
@hexed perch sounds like a simple API endpoint which you can use DRF for.
what is DRF? @opaque rivet
@quiet ridge what a lovely website!!
@hexed perch django rest framework, it allows you to make APIs with django.
ya @opaque rivet i am using django rest framework
my question was, how can i make reverse api request like server to front end
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?
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)
when i try to do something like this of any sort it either doesnt delete or just doesnt do anything
restart the pc. try again. thats the only solition i know
......i spent to long tryibg to find a solution
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
if you type resmon into your terminal, go to network, go to Listening ports, you'll see what's currently listening on your ports. sometimes, python.exe will keep listening to whatever port you set your server as (I guess it's a bug) even when you restart your IDE. just restarting the computer will sort that out.
@static basin thanks
servers can push to front ends, but its not a request. its the frontend subscribing to the server. servers can't just push to a frontend without an initial request from the front end. for security reasons as much as anything
ya front end will provide some initial data to server and then server will process.
serious question, how many people use <UL> for links rather then <div> flexboxes? im just curious
Hey guys, how should i go about streaming web cam in browser to my flask backend?
@wicked elbow I use divs
hi
thats how ive always done it too, but when i watch styling videos i see a lot of nav links created with <ul> rather then <div>'s and i was just curious how many do
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?
Has anyone received external funding for their project/startup? I've come to that stage but I have no idea where to start.
Well the website is under construction construction but please tell me if I need anything to upgrade use scoop@gmail.com and scoop12345 to directly login
https://scoopy.herokuapp.com/
Well you can try something new if you don't have to repay
For a flask app, what's a way to do user email verification during signup?
Do you mean like sending a confirmation link that the user has to click on?
Yeah, that
What do you mean by "don't know where you start?"
You could use smtp lib to send the person an email, then include a link that redirects to the place you want.
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.
@stable hemlock , awesome . this is what i was looking for ๐
how to write text in a background image?
@mental crater yoo can you flask mail and tokens
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'
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 ๐
yea, i need to look into all this myself. i want to launch my project but theres zero chance i can fund it past a good beta test. the internet is an expensive place
Got it.
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
I'm building something with Django... I need some icons, what would you recommend?
I saw this library but I don't know it:
https://pypi.org/project/django-icons/
how can i add multiple episodes with the same anime name ? cause everytime i go create new episode i have to search for it
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
Many to many relationship with episodes for each anime
Say you have 2 tables: Anime and Episode
You'd setup a one-to-many relationship between the two, as one anime can have many episodes, and those episodes all link back to one anime.
https://docs.djangoproject.com/en/3.1/topics/db/examples/many_to_one/
Then you can easily group each episode by the anime
@opaque rivet thanks
@wicked elbow found this cool "startup school" from YCombinator, thought I'd share ๐
6 week class oh man
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.
Top Agriculture Drones Startups
drone startups are really intruiging to me, but they do seem a bit crowded imo
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
i fully plan on launching this, 100% but its gonna take a bit. gonna save up and build my own server i think. be the most cost effective in the long run
i like the look, simplistic and nice
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
Maybe add some svg patterns instead of plain colors. Add some visual variety.
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
looks nice and clean to me.
cool site man
Can someone give me a decently easy website idea for me to make local host?
Bro this is amazing! I suggest adding a feature where you can like/dislike people's posts or comment.
it looks minimalistic
which isnโt necessarily bad
That's true, just don't want it to be to plain either. I hate landing pages
hm.
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
Absolutely when it's actually in use. Just not a lot of data to go off of when it's just me
Thanks dude
Sure man
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?
request.data.get('id', none) maybe hard to tell what your doing from your description
thats django anyways
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
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
try using an env
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
move it a different file and not upload it
Ok will try it ! Thanks
can someone explain what django signals are used for?
@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?
also this sounds more like a html/css question, rather than flask
Yep
Bootstrap
Idk why
Sh** i need to turn on pc
Btw it is looking like hyperlinks
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
Where is the img path?
Are you importing bootstrap?
Ping me when you come!
Yes
I mean i was using navbar
It looks like this
I copied starter templete for bootstrap
And navbar code also from bootstrap
@tribal pewter
i have added the img path i just hid it in the msg
Something is wrong importing the CSS if you have everything imported right check your JS console to see if there is any error
and a screenshot of your code would be very useful
Not in others pc
Not in pc but it is same
First starter templete of bootstrap
Then navbar code inside body
Whats the problem?
@tribal pewter
Should I have to download anything?
Please tell
If you are linking to the bootstrap cdn then no you don't have to download anything
<!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>
The CSS is not loading
What can i do to load it
try doing
<p class="text-danger">some text</p>
and see what the output is
Others can load succesfully
otherwise idk how we could help you if you're not on your PC
You need my code
?
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
Ok
{{ description }}
html code
index.html
@tribal pewter
@gray creek
u here astros?
that worked completely fine for me
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
<p class="text-danger">some text</p>
where to add?
add that to test if bootstrap is getting imported
in the body?
in the body
yes this wont solve it just to see if bootstrap is imported
no
everything is like that before
same text and hyperlinks
anyother solutions?
is this text in red?
can i get a screenshot of your page
ok right click anywhere on the page go to inspect than console and see if there is any error
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?
err_name_not_resolved..
That's a DNS error
Check your system's dns setup/internet connection, those urls should load
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?
make sure they're not running on the same port
means?
internet connection is pretty well, i am having router
Try going to the URLs in your browser manually, by pasting them into the url bar. Do they work? they should.
ookay let me check
nah bro
not checking
@native root
not working*
any other solution?
Something's wrong with your browser/internet
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
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
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
Discord bots dont need a port to run
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
i am on windows
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
Sorry, got a little distracted with other stuff but glad you figured that part out
yeah
thanks bro
i also fixed the dns problem
now i will start learning from tomorrow
thanks once again]
guys how can i ban all characters but space and letters in a field of a flask form?
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
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?
Same
pls upvote if u cant help
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.
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?
You could go with Django or flask If you are new to python Its better to learn python first then learn a framework (I recommend Django )
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)')
That website does not exist, I changed it to some example. Check my terminal..
I get that as a response
Hey, thank you very much, I pretty much know python now, the object oriented nature of python and everything, could you suggest me where can I find good beginner level resources for Django?
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.
I would highly recommend checking out the official Django docs first it have a solid tutorial to get you started
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
why doesn't bootstrap cards work? it might because i have scrollsnap, how can i fix it?
if anyone wants to help ping me here is the code https://codepen.io/happyperson10/pen/xxgwNga
someone please explain me why k='hello' k[0]=5 console.log(k[0])
i get no error when i try to change
how would I start a quark website from a different file
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
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)
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)
Flask would be easier and more lightweight
And simpler
oh aight thanks a lot
depends on how much you want to put in to it, if its just a simple website where you can read documentation, download source code, etc use flask but if you want something more heavyweight look into django
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
not really
they're two very diffrent styles
doesnt really matter what you pick
just go with one
both have massive ecosystems
You can switch, but you will have to redo most of the Python code. (The html templates can be mostly reused) i personally found Django easier to do what I needed to do, but it is mostly a preference as to which one to use.
oh aight ill start out with flask since its easier for a beginner? then eventually learn django
I am not sure if Flask is easier for a Beginner or not. (it depends on what you want to do.) If you are doing a mostly static site that does not need to interface with your Bot or a database then Flask is probably easier. If you do need to interface with a bot, or access a database, I think Django is easier for those things.
oh then ill use django because it is working with my bot in a sense
thanks!
is anyone have project for me my expertise on ReactJS, PHP, Laravel and wordpress
Why is Heroku free and not ask for credit card information but Web services like AWS and Digital cloud ask for credit card information
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
This is specifically useful if you want users to be able to "login with Discord" on your site.
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
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)
Guys, can you help me to choose framework for aws deploy serverless(mostly) applications by python!?
ohh thanks a lot ill watch it!!
Are you using bootstrap?
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.
here is how it should look like https://codepen.io/mavo/pen/BapoXre and here is my code https://codepen.io/happyperson10/pen/poRgNJN what's different that it doesn't work
@tepid lark
well first it should be class not className
i have react
ah nvm
figured it out
@royal ibex This is the place.

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)
@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?
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
as a matter of style, the class should be named IngestFile, unless django has style rules that I'm not aware of.
Nah pycharm did tell me that
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?
(for the record, UhOhCannon is a classmate of mine. I'm not being rude to random server members.)
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
the path to the object? I'm not sure what you mean by that. The object an abstraction for data that's on your computer somewhere.
is it supposed to represent a file, and your goal was for the __str__ method to return a path to it?
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
why does this command open two node shells and doesn't install express ? it worked yesterday
svg generator
can someone help me with something in django?
Sure
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 ๐
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
not surprised to hear that, I'm basically going into this blindly since I've never done it before so I have no idea what's best for this stuff
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
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
I don't know where to start but I feel like it should be fairly easy
Vps's are not that expensive.
Django and flask have built in form elements that support users uploading files. You could take in the file that way, then process it and output it in either of the ways you describe.
for that kinda thing
you could consider AWS SageMaker
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
Create a form or use javascript? ๐ค
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.
What exactly you want to do within that form?
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)
I want to create a record, delete it, edit it, search and show record details and also list it. all that within the HTML form by using the database.
You probably can't do that within single form ๐
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
Consider using django or fastapi
That would be a pain to do in plain python without any frameworks or libraries
or you can also have a database hosted somewhere and connect with it using javascript
No
but I would say a framework is what is required
Just... a bad idea
do you have any reference or anything that can help me with using django or fastapi?
there should be a tutorial on the website
Thank you two. I preciate the immediate help. Have a good one guys! cheers.
before that
you should look at how wed dev works
I mean, learning about what is frontend and backend
cuz django is a backend
@marsh canyon Btw are you familiar with django? ๐ค
Yeah I know dont worry
How should i go about creating services in django compared to say laravel?
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
so whats the problem after that?
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
I think even file cache will do?
yea I guess, but no a big fan of those
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
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 ๐
what is business logic
Any application logic
It can be called literally anywhere i guess
Most commonly in views ๐ค if i stick to an example with api
You're gonna get a bonk if you're storing those passwords in plain text instead of hashing them 
What passwords?
with login/password attached
if you are gonna use them in your views, then it makes sense to put them near the views, if you doing 1 view per .py file, then put the function inside that file
Then ignore me
So to the .env they go
if its something that needs to run periodically, then just background tasks, like cornjobs on linux
Wouldn't it be beetter to create something like service object or at least services directory/py file?
eh, I am not sure what that means, but if it seems right to you and works, go ahead
๐ฌ
@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 ๐
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"```
this is start.py
and start.py is in a folder called main
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
Where are you importing reverse from and which framework are you using?
views.py class PostUpdateView(UpdateView) and PostCreateView(LoginRequiredMixin, CreateView)
I just need the explanation of the use of reverse and redirect
Which website is perfect for learning of HTML CSS BOOTSTRAP JAVASCRIPT?
Just make anything you want ๐
What??
What is your question exactly?
Which website for learn ?
You want to create a website or learn these technologies on a website?
Oh, just use anything you find suitable for you
books, youtube
But suggest me
It depends on what you want to learn
You would have to practice anyway so think of a project you can make
codecademy
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...
how did you do it?
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?
<!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>
I don't see an issue with that, except for the variables not being explicit.
People say the onload way of doing things is not recommended, and what do you mean about the variables not being explicit?
variables d and n don't tell you much.
https://stackoverflow.com/questions/20180251/when-to-use-window-onload
Ah ok
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?
I think your in debug mode
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
I cant explain properly so just watch this
Learn how to create custom 404 template in Django in less than 2 minutes.
oh, thank you very much
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.
W3 schools, tutorialspoint
Hey Guys
I wan to develop a LMS in django
*want
Can someone recommend me some good repos which I can start with?
guys can anyone advice a jsonrpc-client
i don't know why my form isn't sending data back
do you see some http responses ? like 404 or 200
not in the error no
wait let me check devtools
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
xD
i don't think the request went through
what did the server say?
that's just bootstrap stuff
in the terminal?
yeah
ok it means your stuff doesn't get rendered
the form?
ye
how should i get it to render
try to debug yourself, do
render_template("index.html", title="Search", form=form)
in a separate file (debug session)
check what it is returning
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)
i did https://codepen.io/happyperson10/pen/oNBxzao and it's still shows me / page why?
@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.
add after import
app = Flask(__name__)
app.app_context().push()
this is python channel, not react one
however, you should paste your react code to js textarea (on the right)
also these guys are not defined
<Mynavbar />
<Myimage />
<Mycontact />
thats why you'll see the empty page
Give your Route the exact prop. If you have:
<Router>
<Switch>
<Route path="/" component={} />
<Route path="/my_path/" component={} />
</Switch>
</Router>
The 1st route would capture all the other routes. By giving the exact prop to the routes, they will capture routes that exactly match the URL path.
i solved it the problem was exactness so <Route exact path="/contact"> works but thanks
Yeah that's what I was trying to suggest ๐
ok
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?
how to use overflow: hidden outside of a body{}?
@native tide ? What do you mean by that
it deosn't seem that i can use overflow:hidden outside out of a body{} like a class div
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
what is a class of element?
@native tide
https://www.w3schools.com/html/html_classes.asp
oh you mean that, i tried putting overflow: hidden; in the main div it doesn't seem to work
Have you tried to inspect element to ensure that you selected the right div?
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
Anyone have a good easy to follow flask/Ajax tutorial?
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.
does client.run hold the program flow?
Multiprocessing / multithreading? Or u could just make 2 different scripts for them
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
Hi is this where I can ask about Python Dash?
i do that
but still doesnt work
you mean instead of event.target.value, event.target.files[0].name, right?
@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.
is anyone here .......
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?
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!!!
nvm it work now
first make sure your form is sending a POST request and include the csrf token inside the form
hmm
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
@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
is this all you have in this views
no I have alot
you should add the return render(your template) outside the if statement
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", {})
you get the error when submitting the form or when trying to access the page?
access the page
you are returning response but you haven't defined it
so replace all you response with request
@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?
yes
returns same error
The view main.views.home didn't return an HttpResponse object. It returned None instead.
try adding a return in the if method ...
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?
ye
same error ๐ฆ
can i get a ss of your code
?
added secret key and flask import as well and got this https://pastebin.com/twWPCyK0
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
no it doesn't solve it
ah i'm an idiot @tribal pewter
I didn't return the home function
no more errors xd
Oh yes ๐
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
Add an action to your form where it returns to the url of yeetman views
uh
