#web-development
2 messages Β· Page 135 of 1
Well. What is your opinion on the developer job's saturation? Is it really saturated? ( 2021-2022)
I still have a few years until i am old enough to apply for jobs
theres not enough programmers. most programmers are just hobbyists
Haha alright
hi guys! any1 home?
I am trying to deploy a django app but im having trouble
gunicorn works when i use it inline with bash command: gunicorn -b /path/to/projectname/projectname.sock projectname.wsgi:application
but not when running on systemd service
also the systemd service says its running fine
deploy where
so im deploying in a ubuntu hosted os
not using any PaaS solution?
the real thing im trying to figure out is where the .sock file is being created.
i use digitalocean droplets
thing is i want to share the nginx routes with this app
and my other things like resume site etc
π’ everything says active and green just dont know where the .sock is being created lol
omg..
I failed..
So idk why it's creating the .sock file somewhere else
gunicorn creates a file called .sock that is basically the server with various workers for a python flask/django app
i figured it out lol.
π
i basically used a grep command i googled to find all files that end with sock
.sock extension
and bam i found the thing it made :/
any selenium\requests-HTML users here?
guys is anyone here good at react?
Nope, giving an empty object
Is there any method for password hashing in flask?-
there are flask-bcrypt and in werkzeug
Hello i need help for django
can someone please help me here?
plz dont spam probably someone will help
ok
you can use splinter
the question is related to drf
anyone familiar with it here? can someone please help?
data request form?
Hi just want to ask a question for web developers. before you get into your job did your company uses a tool to assess your knowledge? what was is and what company? thanks for the help
You should grab a help channel instead
You can just click on chrome! is that what you're asking?
Who is good in django
i know some, what do you need
anyone?
How could i make the remove fit on the screen and not overflow in bootstrap ? code is here https://mystb.in/HarborMudPlayers.xml
Hi, i wanted to learn mobile development and was wondering if react was a good choice. I would only use this framework to create UIs and animations, while the sauce of the app would be written in C. Any of you know if this is possible, if it is, which frameworks do you advise?
doesn't flutter have lots of problems?
no
regarding janky animations?
works fine for me
ok, thanks
tht's what i'm trying to figure out ahah
i just need a simple framework to deploy good user experience in short times
then i'll migrate to native kotlin and swift
yeah i dont think you can use just c like that, you have to use the backend that react supports and i think it is react.js
yeah thats good its what we did
i'll make some research, thanks for your help. If anyone else knows more please dont be shy
Hello Guys! I'm learning DJango REST by building a WebApp.
I've made some views using viewsets.ModelViewSet to use its default actions ( create )
One of my WebApp Models has a ForeingKeyField ( a common AbstractUser id ). What i'm trying to do is to test the creation of that model using APITestCase but I'm getting a response back with a 400 Bad Request status code.
Is possible to create a model instance that has a ForeignKey using the default actions from ModelViewSet? or should I create a custom create action for this?
hey
can someone please help me here with drf?
hello
hey, what is the real time moving stuff in a webpage called?
like a real-time chat, what is that element(?) called in web language?
I'm looking for some help on django, any ideas where to ask ?
you can open up a help-channel for focused help, or right here would be fine too
I'm having some issues with migrations, the idea was to create a new user model, when I execute manage.py migrate I get this error
django.db.migrations.exceptions.InconsistentMigrationHistory: Migration admin.0001_initial is applied before its dependency users.0001_initial on database 'default'.
found on google some solutions but I don't think it's the right way to do things. In order to solve it you have to reset migrations and re-migrate everything again ...
I don't think it's something anyone want to do on production ..
looks like it's not something simple, at least not automatic
anyone with good knowledge about a python flask project and deployment in heroku? Seems like I cant get it to work after the last deployment including authentication with jwt tokens. I cant post anything to the postgres db anymore :/
Hey I had a question,
If I'm into web dev and related stuff should I learn CSS? I'm not sure if CSS is exclusively used for web dev but I think it majorly does?
If you going to focus on Front-end development or Full-Stack<< All in one π
more or less, yeah.
Which one is better?
Flask or Fast API ?
Depends what kind of web dev you want do. For mostly backend you can but itβs not a necessity. Just learn how it work and itβs good enough. Also you have stuff like bootstrap and tailwind which does a lot of css for you.
Depends what you are doing for project
Hey im looking for a tool to a) create charts for statistics (like google charts) and b) able to code everything in python (pls no javascript ...)
Hi, I facing some issues regarding Django. When I tried to run, it prompt "No Such Table on XXX". Solution that i have taken:** 1. Python manage.py make migrations/ migrate . 2.** Make sure the APP added into INSTALLED_APP.** 3. ** Delete entire migrations done and re-done the step 1
if its like a social media?
You are building what for social media?
Simple api or more complex project with login, likes posts etc
So then better to use like django
ikr
Because that is web framework and will make it easier to do all this
any suggestions?
Why canβt you use js but?
because i dont know anything about js and it seems like cancer tbh
yes but how?
i got the basic charts in an html file working, but i dont konw how to feed it data
The JS is part of your view yes?
JS is part of my html, which just displays a google chart
and it takes data, specified like this:
Do you have like a controller or anything like this which tells python to show this html page etc?
var data = google.visualization.arrayToDataTable([
['Genre', 'GorillaTraps', 'PestCam', 'Beep', 'Direct',
'Pro', 'FuturaCam', { role: 'annotation' } ],
['2020', 10, 24, 20, 32, 18, 5, ''],
['2021', 16, 22, 23, 30, 16, 9, ''],
['2022', 28, 19, 29, 30, 12, 13, '']
]);
and i want to replace the pre defined list (genre, otraps etc.) with something from like a python list
but i dont know how to connect this html file with javascript with some json out of python
i got an html file with one chart from google in javascript
and i got a python script that uses api calls for json files
this json files contains the data i need to feed "into" the javascript thing
the javascript data is the thing i just pasted
right now its hardcoded
What are you using django/flask or what
nothing so far, only html
i really dont know alot about web development regarding python
so youre recommending django?
I am trying to cache using memcached in django, but for some reason when I try to get my key it returns None
im working on a website that needs to display statistics that i get from a large json api call
There is different options available but you have decide which is good for you
Ok so then flask will be good for this
Easy to do and less complexity
Ok no worry
Basically you will have a python file where you can pass data to the html and in the html file you can pass data to the js script
ok i see, so i should look into: how to transfer data from pytohno to html and how to transfer in html to javascript
right?
I donβt know what is pytohno
But you donβt really pass from html to js, the data will just be available for you to pass to the js
python πππ
problem: these charts in flask look like ****
Dash python seems to fit my problem
ill have to look up those terms as i just started with web dev like a day ago, i made a very simple flask app watching a tutorial and got really fascinated with everything websites. thanks for your input ! :D
If he's in a python server uwu i will bet 70% he wants to do backend
Everyone usually do fronted dev though, because it's easy. Not everyone can do backend
where can i start learning django?
i wanna kinda do both like you know what i mean i wanna learn everything there is
I suggest reading the official docs then proceed on doing a todo list app using the knowledge
Django documentation π
Or youtube videos are an option too
What I heard from some experts that, Django poll project are too complex for beginner
Best way to learn, gets your hand dirty, create various tiny project
Does anyone know why my forn is neverbeing validated?
@app.route("/", methods=['GET', 'POST'])
def home():
form = ReusableForm()
if form.validate_on_submit():
answer1 = form.Num1 + form.Num2
flash(answer1)
return render_template('math.html', form = form)
class ReusableForm(FlaskForm):
Num1 = TextField('Num1')
Num2 = TextField('Num2')
submit = SubmitField('Submit')
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
{{ message }}
{% endfor %}
{% endif %}
{% endwith %}
<form action="/">
{{ form.Num1 }}
{{ form.Num2 }}
{{ form.submit}}
</form>
I think my form is just getting, NOT posting
Did not touch that for a while bit I think you should add method="post" to the form
ohh how?
<form action="/", methods=["POST", "GET"]>
action="/" method="POST"
I think you have a mess in your head regarding html vs python
Please make sure you understand where is which
It should work after you submit the form
this my HTMl
<form action="/" method="POST">
{{ form.Num1 }}
{{ form.Num2 }}
{{ form.submit}}
</form>
sendign a video rn
Is there output from the server side?
if form.validate_on_submit():
is never happening i beleive
Look at server output or log
Server is the process, where python runs
Terminal maybe
You should see some log where it says GET or POST for each request
127.0.0.1 - - [19/Feb/2021 13:49:14] "[37mPOST /?Num1=1&Num2=1&submit=Submit HTTP/1.1[0m" 200 -
127.0.0.1 - - [19/Feb/2021 13:49:15] "[37mPOST /?Num1=1&Num2=1&submit=Submit HTTP/1.1[0m" 200 -
127.0.0.1 - - [19/Feb/2021 13:49:16] "[37mPOST / HTTP/1.1[0m" 200 -
127.0.0.1 - - [19/Feb/2021 13:49:16] "[37mPOST / HTTP/1.1[0m" 200 -
127.0.0.1 - - [19/Feb/2021 13:49:17] "[37mPOST / HTTP/1.1[0m" 200 -
im getting LOTs of post requests
that means it is posting indeed
Yes, for each click on the submit button
yes. I am not able to find the problem here
Probably validate_on_submit returns false
You can add print statement to check that
Well, I'm not familiar with that function. You'll have to dig into docs to understand how it supposed to work
thank you for your help @quasi stratus
Welcome
I am trying to run memcached on windows, but I keep getting this when I try to run memcached.exe -d start, I get failed to start service
any ideas of what could be causing this and what could be done to fix this?
@limber laurel what about memcached -d install ?
I got the error
Failed to install or already installed @Erik85#7591
I also made sure I am running it in the admin cmd
@limber laurel ok that was the next thing i was gona suggest. no idea then.
https://sourceb.in/cXfEbhEItZ
on line 57 im getting an error saying await can only be used in an async function
but idk where to add async
so can anyone help?
please and thanks
ping if u can answer
Reask from #python-discussion
Anyone aware of a json pretty printer that enables Conditional compact of objects with specific properties
hey guys. Suppose i have a list of objects 'movies' ```js
const movies = [
{
_id: "5b21ca3eeb7f6fbccd471815",
title: "Terminator",
genre: { _id: "5b21ca3eeb7f6fbccd471818", name: "Action" },
numberInStock: 6,
dailyRentalRate: 2.5,
publishDate: "2018-01-03T19:04:28.809Z",
},
{
_id: "5b21ca3eeb7f6fbccd471816",
title: "Die Hard",
genre: { _id: "5b21ca3eeb7f6fbccd471818", name: "Action" },
numberInStock: 5,
dailyRentalRate: 2.5,
},
{
_id: "5b21ca3eeb7f6fbccd471817",
title: "Get Out",
genre: { _id: "5b21ca3eeb7f6fbccd471820", name: "Thriller" },
numberInStock: 8,
dailyRentalRate: 3.5,
},
{
_id: "5b21ca3eeb7f6fbccd471819",
title: "Trip to Italy",
genre: { _id: "5b21ca3eeb7f6fbccd471814", name: "Comedy" },
numberInStock: 7,
dailyRentalRate: 3.5,
},
{
_id: "5b21ca3eeb7f6fbccd47181a",
title: "Airplane",
genre: { _id: "5b21ca3eeb7f6fbccd471814", name: "Comedy" },
numberInStock: 7,
dailyRentalRate: 3.5,
},
{
_id: "5b21ca3eeb7f6fbccd47181b",
title: "Wedding Crashers",
genre: { _id: "5b21ca3eeb7f6fbccd471814", name: "Comedy" },
numberInStock: 7,
dailyRentalRate: 3.5,
},
{
_id: "5b21ca3eeb7f6fbccd47181e",
title: "Gone Girl",
genre: { _id: "5b21ca3eeb7f6fbccd471820", name: "Thriller" },
numberInStock: 7,
dailyRentalRate: 4.5,
}
];
I want to get a certain movie depending on the _id
and return it's index
...isn't this JS
yes
movies.map((e, i) => [e, i]).filter(([e, i]) => e._id === id)[0][1]
@native tide this should work
Is Flask complicated?
Ive been trying to get into it
BUt I just dont know what IM doing
Am I taking the wrong approach?
Flask is easier than django
it took me a while to figure out the app factory pattern in Flask
and how to get it working with flask-sqlalchemy
but once that's in place it's a solid setup
html
<div id = "video"><iframe width="300" height="300" src="https://www.youtube.com/embed/rUWxSEwctFU" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>
<div id = "button"><button type="button">Click Me!</button></div>
css
#button{
background-color: bisque;
padding: 12px 28px;
border-radius: 15px ;
font-size: 24px;
position: absolute;
left: 100px;
up: 30px;
}
``` Javscript
(function showPlayButton() {
if (document.getElementById('video').ended) {
document.getElementById('button').style.display = 'block';
}
setTimeout(showPlayButton, 1000);
})();
``` can someone explain why it isnt working?
I want the button to appear once the video finishes
I want to make a website for mainly personal use, can someone point me in the right direction to start learning how to do that?
I'll recommend https://developer.mozilla.org/en-US/docs/Learn and http://javascript.info/
has anyone created an authenticated flask page with pysaml2 & okta?
the pysaml2 docs aren't so easy for me to follow
guys anybody have experience in django websocket and redis channels ?
have worked with Rabbit MQ as I was tasked to use it and not celery ...let me know if u need any help
Thank you . it was an error of bzopmin in channel redis but after installing it with sudo snap solved the issue
Rabit MQ !! what is it used for dude
print("Hello")
lol! check it out ...it is like a message broker
for sure dude . Thank you for responding
Hello, can anyone help me with Flask deployment? I built a simple Flask app and it runs locally but I've been trying to deploy it since yesterday to no avail. I tried both PythonAnywhere and Heroku
My github repo is here: https://github.com/TohDeKai/available_uni_courses
anyone please can help with django channels?
https://stackoverflow.com/questions/66289521/django-channels-add-user-to-multiple-groups-on-connect
or on github regarding the same
?
Hey
Is there a way to use html forms with python
<form action= pythonfile.py method = get>
And then collect the data and do whatever I want to do with it through python
What should I do when my django app lost connection with database?
hey devs what is difference between static and dynamic site
hi
static is
is way cheaper and has a better fire wall
than dynamic
so basicly static is beter
π hey all new here and new to python (I'm a designer/front-end). If this is not the correct channel let me know!
I'm building a rest api with flask and I'm struggling a bit with how to structure my files, imports, etc. Currently I have something like:
app
|_ /models
|_ <models go here>
|_ /routes
|_ users.py
|_ recipes.py
|_ ...
|_main.py
I'm initialising my app in main.py
# Init app
def create_app():
app = Flask(__name__)
CORS(app)
app_config = DevelopmentConfig
app.config.from_object(app_config)
jwt = JWTManager(app)
db.init_app(app)
from app.routes.users import user_routes
...
return app
but then... how do I import jwt on routes/users.py when I want to do something like @jwt.user_identity_loader??
As I understand it, I could write something like this, so I can extract the user id from the auth token:
@recipe_routes.route('/', methods=['GET'])
@jwt_required()
@jwt.user_identity_loader
def get_recipes(user):
I don't want all my routes to be inside main.py's create_app but on a different file, but as jwt is init there... I have no clue how to import it on a different file. Hope it makes sense, I'm brand new to python/back-end dev π
boys help me
i have to write js
how to test a property of an object π
const numberOperations = {
powNumber: function (num) {
return num * num;
},
numberChecker: function (input) {
input = Number(input);
if (isNaN(input)) {
throw new Error('The input is not a number!');
}
how to access this numberChecker
numberOperations.numberChecker
but u missed 2 curly brackets at the end
const numberOperations = {
powNumber: function (num) {
return num * num;
},
numberChecker: function (input) {
input = Number(input);
if (isNaN(input)) {
throw new Error('The input is not a number!');
}
}
Language is just a tool
I have a question about url patterns on django:
I'm trying to access api/token but it's using the wiki.api.url view instead of the TokenObtainPairview. I thought that with the order I should be able to access the tokens?
path('api-auth/', include ('rest_framework.urls')),
path('admin/', admin.site.urls),
path('api/', include('wiki.api.urls')),
path('api/token/', TokenObtainPairView.as_view(), name='token_obtain_pair'),
path('api/token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
path('wiki/', include('wiki.urls')),
]```
Hello
how do I get discord users guilds in django allauth ?
Hello! what things do you usually log in every request in your webapp? I'm guessing request_id and host and env but what else?
Where is this file in ur directory? Is it the main urls.py file?
Have you used postman?
What is the output or POST method on /api/token endpoint?
for*
functions in an object? shouldn't the functions be in a class instead
its javascript
https://donjayamanne.github.io/pythonVSCodeDocs/docs/troubleshooting_linting/ not sure if links are allowed but this may help
Hey can someone please tell me what type of web apps are needed in 2021 for common use ?
Web apps? Languages? Frameworks?
Its javascript. It's valid
just use html
if you guys were to pick from python or php as back-end, which one will you choose as an easier language?
im really having trouble using python django with connecting it to my db
def django
definetly
php was my first language but seeing the ease in django and it's rapid in production... I prefer django.
But php is a bit faster than python
As a backend, I have really been liking FastAPI. Interops well with most of the expected tools and chains for the most part.
im really getting confused on django because of too many path
also with those generated stuff that i didnt know
like this, django automatically generated these tables
anyway, i think i'll be familiarizing first with php and eventually try to switch to python when im experienced
if that's what you want
we're lacking in time and someone said php is bit faster
oh ur the one lel
anyway thanks!!
but will it have some generated tables like django did?
If you are looking for a php based framework, I would suggest Laravel if you wanted something in the same realm or equivalent to Django
No. You make your own tables and database.
Just vanilla php can do alot of stuff. I made alot of stuff using plain php
Django can also not have premade tables... That's because you used the default django settings it has them premade.
There are more positions for laravel jobs but you will be paid less compared to django, in the UK anyways.
Web apps
In this Python Flask Tutorial, we will be learning how to get started using the Flask framework. We will install the necessary packages and get a basic Hello World Application running in our browser. Let's get started...
The code for this series can be found at:
https://github.com/CoreyMSchafer/code_snippets/tree/master/Python/Flask_Blog
Djang...
at 7:25 he types cd Flask_Blog/
and it works in his terminal
but when i try it nothing happens
it says no file or directory
confusion
i'm just trying to follow the tutorial
^
how do you see the file structure
sorry am big noob
yeah i don't know how to see the file structure on VSC
Anyone working as py developer ping me
that's not it
does that help???
how do you even see the file structure in vsc
ugh i have another question
here corey types $ flask run
but when i type $ flask run it says command not recognized
is flask installed
yes
are you sure? try opening the interpreter and importing it
are you typing in $ flask run or just flask run
like >>> is for the interpreter
you need to set the FLASK_APP env variable
and the FLASK_ENV if you want
ok i think i got it
thanks
@noble spoke the problem was my dumbass using a $
sorry am noob to flask
lmao its ok
just run the .py file
just run flaskblog.py and it will work correctly ( on the cmd )
could not import flaskblog
big mad
oh i may be stupid again
i called it flaskblog
did i just dox myself
whoops time to change my name
anyways why is this wrong
i'm mad
i don't know why i can't figure it out
i swear if i cannot figure this out by tomorrow i'm doing more hackerrank
nah jk
does anyone know
lol
If you know how to do hackerrank why don't u know how to do this
This is really the basics...
I just read a 5 min art on flask and i can do stuff in flask now
i don't know how to do hackerrank
i don't need you to shame me for not being able to do the basics
what do you want me to say? congrats?
less talking more reading if you wanna get anywhere with this
what do you think i've been doing
from flask import Flask
app = Flask(__name__)
@app.route("/home")
def home():
return "Hello!"
if __name__ == "__main__":
app.run()
when i type in flaskblog.py as my file name in the terminal it says command not found
that's what techwithtim does in his video
Welcome to the first flask tutorial! This series will show you how to create websites with python using the micro framework flask. Flask is designed for quick development of simple web applications and is much easier to learn and use than django. If you are less experienced with python and want to learn how to make websites flask is the right to...
it's this video
SyntaxError: invalid syntax
>>> /opt/anaconda3/bin/python "/Users/rahuldas/visual Studio worskpace/Web App Drawing/flaskblog.py"
File "<stdin>", line 1
/opt/anaconda3/bin/python "/Users/rahuldas/visual Studio worskpace/Web App Drawing/flaskblog.py"
^
SyntaxError: invalid syntax
Iβll read more flask stuff before asking more questions
@spare iris full stack is when you develop both the front and back end
oh
ok
i was following this tutorial
- Serving Flask app "hello" (lazy loading)
- Environment: development
- Debug mode: on
- Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
- Restarting with stat
- Debugger is active!
- Debugger PIN: 813-894-335
this is what it said
i clicked on the link expecting to see hello world but i saw something else
i'm confused
i guess this is just too basic to help with huh
Ok
Theres one thing you have to do everytime you restart your terminal for flask
Env variables dont persist, you need to re export them
export FLASK_APP=hello
The flaskapp var is supposed to be the file name
Its called the "entrypoint" to the application
so flask_app should be flaskblog.py
Yes
ok
you can't just do export flaskblog.py = hello ?
No, flask looks at the environment variables for one named FLASK_APP
Its very specific, dont forget it
ok
Terminal
-bash: export: `=hello': not a valid identifier
oh i'm stupid
i thought they were naming it after a function not the file name
ok that worked
export FLASK_APP=flaskblog.py
export FLASK_ENV=development
flask run
and you need that basically every time
you run something on flask
flask.cli.NoAppException: Could not import "flaskblog".
i still see this
i copy pasted what you gave me
i will google that
no it should work
I have been trying to follow the flask tutorial from [http://flask.pocoo.org/docs/1.0/cli/] and i cannot get flask to run.
I get this error
File "d:\pyproject\flaskblog\venv\lib\site-packages\fla...
Show project structure and flaskblog.py
it goes Web App Drawing -> flaskblog.py
web app drawing is a folder
flaskblog.py is a file
this is flaskblog.py
in the terminal?
If you look to the right, it says "Python"
OH
Its the pythonshell
is that where you're supposed to do it
i was doing it in the terminal that comes w the mac
not the IDE
bash: syntax error near unexpected token `flask'
Screenshot
Your app is running
Ok just pick a terminal and stick with it
Either the ide integrated terminal or the other one
let's just do the ide one
it's still asking for a flask app environemtn variable
so let's give it one
Ok, do that again and then flask run
sorry i'm being annoying
why is the damn syntax so particular about spaces
it's hella annoying
OSError: [Errno 48] Address already in use
what does that mean
It means you need to kill the other terminal
i closed it
Not Found
The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
uhhhhh
Did you go to the proper address
Show me the screen
Show me the url too
Did you change the code?
i tried adding http://
no
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return 'Hello, World!'
if __name__ == "__main__":
app.run()
this is the same code as before
i don't get it
I cant see anything wrong
Close the editor and restart it
What tutorial are you following
YAY
a goodie
thanks @noble spoke
π
ok now i have to think of how i want the website to look
does this mean i have to learn HTML again
I guess?
yay
@amber oxide @noble smelt , this is in the main urls.py. I used postman to check the end points that that's how I worked out it's going to the wrong spot.
I get this if I move the api/token url above the api/ url
"username": [
"This field is required."
],
"password": [
"This field is required."
]
}```
but then I get a
``` "detail": "Method \"POST\" not allowed."
if the api/ url is above the api/token
does anyone know how you can have an interactive window on your website where the user can input a few things, submit it, have that info sent to the backend to do calculations on a database, then send back the results to the user?
sounds like a javascript request to the backend. ajax or so...
@noble spoke So I got the webhook to be working with flask, but when I put it into the website, it wasnt able to send anything. I am using the url which is:
http://198.84.238.98:5000/webhook Why isnt it working?
do you have a suggestion for a web development tool to begin working with it? Wordpress, wix, squarespace etc..?
this is why i use streamlit

jk flask is good to learn
but i think django is more popular in industry

well i need to start w somehting
i can do django when i do my internships web app
a web app that helps users find internships
@cinder whale that is my new favorite gif
@strong torrent i suggest looking into Postman
Ok
Its a tool that helps you test http requests
Ok
Its easier than writing curl requests
Ok I will try
I was able to send messages with curl requests but when I tried using the website nothing happened
That's difficult to answer without knowing what you are trying to archive. Maybe claim a help channel and try to explain your goal.
@strong torrent you can try opening the developer tools and looking at the network tab for the request the website sends out
And see whats not working
Hi
There are developer tools?
are there Russians here?
Idk

i mean i will learn flask probably before django too
my prof is going over it in class later in the semester
Youre getting taught flask in uni?
hahahhaha laughs in business major
this is grad school, so yes
Oh ya

i got taught bottle
I just noticed that
Bro when i was in uni the only webdev they taught us was java server pages lmao
Why are such commands that others have highlighted in blue I do not stand out that is, sender, VkApi...?
uhh maybe highlight over it, and it will tell you?
i dont actually use sublime as much
The fact of the matter is that he should automatically select those commands and he does not select them, but I don't understand why .. maybe the problem is in the api
Yes..
In my Flask webapp, I've got a function called process_user_query() in my app.py script which currently handles POST request from a user's **query ** submitted through a HTML form and then calls a different function, display_query_results() to execute some processes and render a different page to the user.. Now I don't want to reload the page nor do I want to redirect the user anywhere.. instead, I just wanna take in the user input from the search box using the process_user_query() in the app's main script and then call display_query_results() to show some content to the user... is this possible to do simply using Python? No, right?
How might I be able to use JS's Fetch API to handle this?
you could post it silently by wrapping the form in a iframe, and then setup a listener in JS with the route you want to results from. Or you could use Ajax to make the post request and get the response from the route @pulsar copper
I don't actually know which way is the most beneficial, the most efficient approach to display the response like that... at the moment I can't quite get my head around the Fetch API tutorial on here: https://towardsdatascience.com/talking-to-python-from-javascript-flask-and-the-fetch-api-e0ef3573c451
Sooo there are lots of ways to retrieve requests and display the response back to the user in webpages, I take?
fetch can't do post requests anyway
afaik
fetch for get I would do something like this
async function getView(){
const f = await fetch('/url')
const response = f.text()
actually yeah fetch can do post requests, my bad I always thought you had to use ajax
So how might it work with the way I want it to do?
JS isn't my strongest, but I would try this:
async function getView(){
const f = await fetch('/url'. {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
somethingtopost: value,
somethingtopost: value
});
const r = f.json() // depending if the response is json, or use f.text()
any suggestions to make it look more modern? just cant shake that it just doesnt look quite right
theres better things then fetch. id suggest axios if you have a choice. its async already
circular profile pics
I think a big part of it is the colour scheme tbh
more or less every popular social media platform I can think of does not use green tones
hm
well
@ this point people associate green with like
restaurants
outdoors
okay the thing also is that it's a very
dark, kinda muted green
which wouldn't be out of place on, say, a meditation website
i just dont wanna do blue... i dont wanna look like facebook
ye that's fine
how about try
more pastel colours?
just an idea
not sure if it'll work
the green quite turns me off tbh
also consider
different chat bubble colours
for incoming and outgoing
also
I don't thnk
you need another div
like
yea, i havent fully jumped on the green either tbh. i tried that as well
the scrollbar should be over the whole container
but the input should be sticky to the bottom
you have extraneous whitespace
the different colored messages. it looked worse then the grey and green
wait
okay if I look closely
outgoing is green
incoming is grey?
they looked the same to me at first
yea
maybe turn up the saturation a bit?
very light colored to keep the black text
or decrease the luminance of the incoming
also
I would say this
it is a pretty stupid convention
to make outgoing messages more striking (in terms of background)
because you know what you sent
what you care about is what the other person sent
i think part of that is the paint screenshot save
so THAT should be the one with the more obvious background
that said
most social media websites disagree with me
or maybe they just didn't think about it
shrugs
i thought the grey was more obvious, easier to read. is it backwards?
thats a bad example cause neither person has profile images
they look almost the same to me
I suppose the question is which stands out more
against hthe background
but
minor point iMO
what do you think about this
i thought thats basically what i did. scrollbar doesnt even exist unless it reaches the max height. but yea, i could shrink some of the white space between the input and the text box
no I'm saying
the chat box should be everything below the header
like I'm presuming your structure is something like
<header>
header
</header>
<section>
<div id="messages">
</div>
<div id="input-container">
<img>
<input>
<button>
</div>
</section>
its set up or basically
-----Header-----
---Links---
--- ------
--- ------
--- ------
thats the whole page, yes im still not set on coloring yet. its just a placeholder more then anything
the page as a whole looks dated
the colours make me feel ill
box-shadow seems a bit too much
the footer is π₯΄
the header is a bit π₯΄
lmao yea, working on the colors
THE TEXT PADDING IS ALL OVER THE PLACE
LOOK AT THE RED HEADER VS THE GREEN HEADER...
π‘
no padding is uniform. the font size is what makes it the look different
...the padding is the same?
I find that quite hard to believe
look at the distance
between the first letter
and the left border
of the container
no seriously though. it does look different, couldnt tell you why, but the padding is the same. checked in dev tools
actually the left padding is different yes, smaller container less padding
IT'S DEFINITELY SMALLER
the padding is off though on the green one, gonna look into it. gotta be a stacked thing though because it looks normal with a profile pic there
I think the fact
that your colour scheme
doesn't really make sense
contributes a lot to the "old website" look
having three primary colours in close proximity to each other is π₯΄
thats instagram for you though. they just use a mostly white scheme these days. im no designer though
i found the extra padding as well, looks much better without it
huh?
I dont' see that on Insta
3 colors, the sites scheme follows those colors. just not in headers. havent seen insta in a while. cant login there or facebook
but most sites use a plain white layout
I...don't remember that on Insta
yeah
like I think
having three colours
like
a triadic colour scheme
is a bit
bold
yea, idk im not a designer by any means, i just code until it looks halfway okay normally
lmao yea. biggest difference between my site and most others is mine is 100% coded by me. not using bootstrap ect. but thats also where the errors lie
Does the site work without reloading?
mine yes, 100%
What did u use?
react
the site is react/axios/rest framework/django
its actually redux that uses axios, but still
theres like 350 files to make the site run
you made React? π₯΄
I'm kidding
no react and bootstrap arent the same thing though... react is a framework, bootstrap is premade html/css/js
lmao
I mean
I think when you say "100% coded by me"
it would imply no frameworks of any kind
almost rather build static pages then to write react components. but then its slow
i.e. pure DOM manipulation with vanilla JS
It's possible with vanilla php too
django is a framework, so is rest framework by that logic
i use only my own programming. no prebuilt components
you dont need to know programming at all to use bootstrap, you have to know html/css/js/jsx to program in react even in the most basic aspects
okay, fair enough
man i removed the white space in that, and it doesnt look good. definitely needs some white space, just maybe a little less
in where
see no white space looks bad. would look good as like a pop up chat, but not so much as an element
increase padding
hm
I would say with more padding it'd look okay
but your choice
but thats what i already had lmao. just white padding instead of slightly offwhite
it makes a difference
okay I guess
you could just make the background white
also increase chat bubble padding I think
seems a bit cramped
yea i thought that too, but its already at 4px
see something like that looks better
i dont like the scrollbar on the edge of the element. it looks bleh
lmao that scrollbar is edited already to get rid of the arrows and make it smaller. lol i meant without the white space like in that picture.
First, in your flask_blog directory, use nano or your favorite editor to create and edit your app.py file. This will hold all the code youβll use to create the blogging application:
what does that mean
i got it from here
i'm confused
what flask_blog directory
i'm so confused
You clearly arent reading the directions are are linking to us
It's the first thing under prerequisites
i'm using VSC
That has no bearing
it literally says "A Python Programming environment". For you, that's in VSC
They are just calling the main project directory flask_blog
you can call it whatever you want
ok?
thats the answer to your question
honestly using one react UI library would make your project so much easier π good luck man
i used to bash my head writing so much css etc.
used ant design once and it's changed everything
nah, css isnt hard if you have a designer. its designing on the fly that causes issues.
yes that's so true
makes me think whether we should plan projects / make mockups before making them π€
people within the industry do for sure
also a big yuck of mine was having to re-write loads of my css to make sites responsive, while these libs often use styling similar to bootstrap to solve that problem
lmao yea, but sense i dont have an eye for design mock ups dont really help π
your more likely to get a front-end job with css experience then you are with only bootstrap experience. not to say bootstrap is all bad.
yeah true
i can get my head around all the css and know what it does in a practical sense, just hated writing it
I have a web-application using Flask. It is searching a kdtree (a datastructure) by loading it once at the top of my code, and then querying the object in every search. Is this the best way? Should I instead load AND query it for every search? Right now, what I'm querying is a global object.
....
I can't see a way to process a plain text data post request in FastAPI
is it possible at all?
Guys, is there an open source for http://pythontutor.com/visualize.html#mode=edit ? I can't find it. Woo-hoo.
Hey any web developer there to work with me on a project
What you project? Why can't you do it yourself?
guys have anybody worked with one to one channels in django !!
I am trying to do a facebook like notification system in my django app
so whenever something happends say if he has been invited to a group he should be notified as like in facebook . I found the best solution to this problem is using django channels . I integrated django channels with signals so whenever a new database instance is created the django post save signal trigger notification to the group . meanwhile the every user connected to the websocket is now getting the notifications . I dont want that . It should be user specific . Has anybody have any idea to solve this riddle using django channels .
I got a webhook working with flask, but when I put it into the website it says:
"webhook_url" must be a valid uri
The url is:
http://198.84.238.98:5000/webhook
Hello Guys,
I need some help with jQuery and DataTable.
I am trying to set the html attribute - checked to true, based on value that comes from a viewmodel (asp.net core) as a row.
Only the attributes of a switch elements on the first page have the "checked" attribute set to true however. What am I doing wrong?
data: function data(row) {
console.log("row", row);
if (row.isActive == true) {
$("#customSwitch" + row.id).prop('checked', true);
}
else if (row.isActive == false){
$("#customSwitch" + row.id).prop('checked', false);
}
return '<div class="custom-control custom-switch"><input type="checkbox" class="custom-control-input" id="customSwitch' + row.id + '"><label class="custom-control-label" id="customSwitch' + row.id + ' for="customSwitch' + row.id + '"></label></div>'
//return '<div class="custom-control custom-switch"><input type="checkbox" class="custom-control-input" id = "customSwitch1"></div>';
},
},```
hello I need help with django form M2M field saving
can someone help me, can I ask the question here directly?
Sure
Ok I have a django form and it works fine but when I save it with the M2M field that field is not save correctly
I have described the problem in detail here: https://stackoverflow.com/questions/66126105/generic-formset-with-m2m-field-not-saving-entry-correctly
but I didn't get any help
Maybe its a very specific issue
Any ideas
Sorry, I have no idea...
hey i need help with css i have a div which stores all things in it and i want all things to align center how i do it?
Can you tell me to go about creating a generic form with a M2M Field?
How would you do it I have been looking for an answer for so long I am willing to change my existing code
because I need a solution
hey everyone, have you tried to put a table in the div with align="centre"
nope
@native tide can you tell me if i have a <div> then how to make is stay in center
something like this might work
<div style="display: flex; justify-content: center; align-items: center;">
<p>This element will now be centered in the container div</p>
</div>
just go and checkout some tutorials like https://www.youtube.com/watch?v=_uQrJ0TkZlc
Python tutorial - Python for beginners
π Learn Python programming for a career in machine learning, data science & web development.
π₯ Want to master Python? Get my Python mastery course: http://bit.ly/35BLHHP
π Subscribe for more Python tutorials like this: https://goo.gl/6PYaGF
π Watch the 2020 edition: https://youtu.be/kqtD5dpn9C8
π Get My ...
I hope this will help
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
crispy forms vs widget tweaks which is easiest to handle css?
Hello, I have the following problem:
I am running Flask with USGI + nginx. I am running 8 processes on UWSGI. I have a endpoint called /stripe/success, it is a webhook endpoint where my payment processor sends a webhook, then there is a coresponding view that determines whether the payment will be captured or released based on stock availability. The problem is that for each request I am retrieving the restock number from the database. Say the restock number is 25 almost always more than 25 users will get charged all processes are not up to date
Would doing:
with uwsgi.lock():
#retrieve restock data here
Work? Would it maybe clip performance by a lot?
Hi all, I'm trying to solve a problem where I need to webscrape from a site where the login is spread over two pages, i.e. enter username, hit OK, then next page asks for password. I am trying to do this via requests rather than Selenium if possible; wondering what would be required for it to work though. Basically my code so far is the following:
import requests
import lxml.html
url_username = 'https://...'
url_password = https://...
s = requests.Session()
# check for hidden fields (there are none apparently that I've found so I didn't do anything with this info anyway)
login = s.get(url_username)
lxml.html.fromstring(login.text)
login_html = lxml.html.fromstring(login.text)
hidden_inputs = login_html.xpath(r'//form//input[@type="hidden"]')
# post the username to the username page (seems to work; gives a 200 response)
s.post(url_username, data={'username': '<myname>'})
# then I try to navigate to the password page and post the password there (doesn't work; get a 404 response)
s.post(url_password, data={'password': 'abc123'})
How is one supposed to do this properly?
is there a way to get parallelism in an api request? As of now the server is waiting for the endpoint to finish for one before it does the other
I'm using FastAPI
this site allows you to webscrape right
otherwise don't bc you can get into serious trouble for it
Okay: have a large document storage system with millions of documents. Has its own web interface and decent API. Looking for a starting point to build something that sits on top to allow document tagging and automation (e.g. building documents together, scripting proofreading, etc)
Chat about potential solutions, and ideas
Im a former software developer
So just looking to tlak about it with someone that is more familiar with the landscape and current technologies
Is the market trending towards more custom solutions or open frameworks that can be customized
I assume it's the former
But, I basically see a lot of these low code/no code solutions making headway in the corporate world
So I dunno
Power apps seems to have the ability to run python scripts that live in Azure
That's close
Instead of webscraping he should have a pyblic api that sends requests and stuff like that like an authentication token
Or he can alternatively have another api that processes that request. While the other api does the other dirty stuff like requesting..... Webscraping and enterinf logins
But since it s a login page every thing can be sent and requested vua web
:)
does anyone has a good django guide for starters?
I'd recommend you the official documentation, it is high quality.
aight thanks
Totally out of context... But when people say it's a bit faster.... I'm sure they meant from nanoseconds to 1s
Fasteness in web server usually refer on requests per seconds
I'd say a lot, development servers do not focus on being faster or secure
none of them scale well
and the moment you get a bit of traffic, you'll notice the drop of quality
Don't forget about your actual host connection
Most of the delay is due to your connection with the ip/website
what's the best way to test using nginx locally?
would you use a virtual os to practise setting up a server that you can connect to?
need some help on this
@subtle frost I'd use docker
agree use docker
ok, so i have a flask server, and a small thingi of js code procedurally creates some options in a html <select>
but when i request.get.form it, it is none
ye, i need to solve this problem thoo
uh i'm not really sure
Youre gonna need to show some code
What does small thingi of js code even mean
Also if you want form data that should be request.form.get("key")
Or request.form["key"]
he's probably gone by now
thanks a lot
hey devs
how to make my site goes brrrrrrrrrr
i mean how to fix this
my site looks weird in mobile mode```
define "weird"
have you heard of adaptive and responsive design
yes and idk how to do that
...in what way is it weird
idk about responsive design
so every thing is like fiting in one place
[21/Feb/2021 21:29:43] "GET / HTTP/1.0" 400 64015
Invalid HTTP_HOST header: 'fuwu.sogou.com'. You may need to add 'fuwu.sogou.com' to ALLOWE
D_HOSTS.
Invalid HTTP_HOST header: 'fuwu.sogou.com'. You may need to add 'fuwu.sogou.com' to ALLOWE
D_HOSTS.
Bad Request: /http:/fuwu.sogou.com/404/index.html
[22/Feb/2021 00:53:11] "GET http://fuwu.sogou.com/404/index.html HTTP/1.1" 400 64984
Bad Request: /http:/fuwu.sogou.com/404/index.html
[22/Feb/2021 00:53:11] "GET http://fuwu.sogou.com/404/index.html HTTP/1.1" 400 64950
[22/Feb/2021 00:53:18] code 400, message Bad request syntax ('\x05\x01\x00')
[22/Feb/2021 00:53:18] "" 400 -
[22/Feb/2021 02:02:42] "GET / HTTP/1.1" 200 773 // good request
[22/Feb/2021 03:15:34] "GET / HTTP/1.1" 200 773 // good request
[22/Feb/2021 06:44:41] code 400, message Bad HTTP/0.9 request type ('\x03\x00\x00/*Γ \x00\x
00\x00\x00\x00Cookie:')
[22/Feb/2021 06:44:41] "/*Γ Cookie: mstshash=Administr" 400 -
``` anyone know why my server is getting spammed in aws? doesnt make sense for any other website to be hitting my server. and its not the first time ive seen it
probably just bots, scanning through all ip ranges on the internet looking for common vulnerabilities that then can be exploited, wouldn't worry too much about it
ya, but thats not an ip ping, thats fuwu.sogou.com linked to my static ip. thats what i dont understand
its a vulnerability attack on flask servers.
it can be several things causing the error, miss configuration somewhere, bots scanning the site, for me it is too ahard to tell from just this log what exactly is causing this, just try to debug if it is something that is caused by your own techstack or from an external actor like a bot or an external user
"/*Γ Cookie: mstshash=Administr" 400 - thats a vulnerability attack on flask servers... not sure what the /http:/fuwu.sogou.com/404/index.html is

its a search engine i guess
has anyone used vercel here ?
@meager prawn what error specifically?
smtplib.SMTPAuthenticationError
sorry did'nt saw this channel
Are you trying to send emails to gmail accounts?
when i try to send mail using gmail and python error occurred this type of question are already in this site but doesn't help to me
gmail_user = "me@gmail.com"
gmail_pwd = "password"
TO = 'friend...
and using this module to make to send mail when somone enter the data in contact page
tried it
but nothing happend
could you send the code?
@app.route('/form', methods=['POST']) def form(): first_name= request.form.get('first_name') last_name= request.form.get('last_name') email= request.form.get('email') message = "You have a new entry....!" server = smtplib.SMTP("smtp.gmail.com",587) server.starttls() server.login('GMAIL',"Password") server.sendmail("GMAIL",email,message) server.quit()
try doing .SMTP_SSL() instead of SMPT, and remove port 587
ok
let me try
smtplib.SMTPNotSupportedError
now getting this errror
smtplib.SMTPNotSupportedError: STARTTLS extension not supported by server. and this error also
Hey, looking for a easy way to display csv files as plots on a website? i was thinking about Dash, any other suggestions?
hey I'm using flask and sqlalchemy to build a rest api, I got a table recipes with id, user_id and name, and a table plans with an id, user_id, date and recipe_id (foreign key).
I'm querying the plans and want to get the recipe name as well as the id, date, recipe_id. I think that's called a left join?
I tried with results = db.session.query(Plan, Recipe).join(Recipe).filter_by(user_id=user_id).all()
but then I have no clue how to serialise that to json with marshmallow_sqlalchemy
and can't find anything relevant in stackoverflow
any ideas?
that query above βοΈ returns this:
[(<Plan 25801978-48e1-487d-9997-6362272d1dfd>, <Recipe 460e695e-e130-41ce-b68e-8409897c5c9b>), (<Plan 95aaf0e0-926e-4824-91ee-6382da42169e>, <Recipe b2fda62a-4319-443e-8a2c-0fc0d297999d>), (<Plan cb418d37-7497-4dc0-96e3-161fb239d0e5>, <Recipe 158a9f8a-9af8-44ca-91d1-da782510c007>)]
which I don't know how to serialise to json with marshmallow
lets see
ideally I'd like a response like:
"plans": [
{
"Plan": {
"id": ... ,
"date": ... ,
"name": "meh",
"user_id": 4
}
},
...
or maybe this, not sure what's the right way
"plans": [
{
"Plan": {
"id": ... ,
"date": ... ,
"user_id": 4
},
"Recipe": {
"name": "meh"
}
},
i think he's trying to turn that query into json format
assuming my join query is done properly π€·
which I don't know, because I just got objects right now
ok so assuming my query is valid, I can't get it into json. If I don't say anything about the recipe on my plan schema like
class PlanSchema(SQLAlchemySchema):
class Meta:
model = Plan
id = auto_field()
user_id = auto_field()
date = auto_field()
recipe_id = auto_field()
it just returns and empty json object.
When I try to nest it like this
class PlanSchema(SQLAlchemySchema):
class Meta:
model = Plan
id = auto_field()
user_id = auto_field()
date = auto_field()
recipe_id = auto_field()
plan = Nested(RecipeSchema)
it just returns recipes, nothing related to the plans
Maybe have a function with a prebuilt json format
Then pass the queries via a for loop to a function that adds the json to an array
for plan, recipe in query:
function(plan, recipie)
I'd expect marshmallow to do that for me... but I can't figure it out how
def function(a, v):
json_format = {
"Plan":a
Blah blah blah
}
array.append(json_format)
I am typing on my phone
Its pain
yeap, got it, that should work, cheers. I just expect marshmallow to do it π Just don't know how. If can't figure it out I'll try that route, cheers
oof
ok I think I got it, the Plan model needed a name db.relationship, or at least that way now it pulls the info without the need of a join, and marshmallow can serialise that info into json
Hi Community. I'm building a website with flask and a mongo DB, for registration I only find tutorials and guides for SQL, do you have any resources for me that I can look at? Appreachiate your help. Cheers. π
If you sending email, best to use a web API service like Amazon SES or https://www.mailgun.com/. Makes it a lot easier than SMTP.
Powerful Transactional Email APIs that enable you to send, receive, and track emails, built with developers in mind. Learn more today!
[u/deleted]
I think #career-advice would be better suited for that
oh ur right didn't see that sry
if im building a flask app should I check if a user is logged in, in the routes or inside of the functions that the routes are using? like if I have /login and it needs to check if the user is already logged in but /login calls a differnt function to handle login stuff which is better practice?
You should have a decorator that checks if the user is logged in before letting them access the route
don't know how to make decorators lol and I don't like using flask forms for the logins
ill look into it tho thx
also how should my app be structured right now app = Flask(name) is in the same file as my routes
should it Be?
and things like flask-limiter should they also be in a seperate file?
@potent geode you should look into the application factory pattern
thank you I will research those
Hey everyone, who is using cloudinary cdn with django? I wondering how can i set image extension when upload image. Currently i'm getting image url likecloudinary.com/media/my_image but i want to have cloudinary.com/media/my_image.jpg
use pillow
just like mine
The image url are hosting from the same site using pillow
set the extension in the public_id
how do you structure your django projects?
I like to keep my application code in an app/src folder instead of the project root (relative to viewing it in github)
Hello, how to conditionally import a package?
I have a two ways of sending emails - at localhost or by Sendgrid. Developer (using my code) can choose between these and needn't to install, import etc. Sendgrid package if they won't use it
anyone worked with django-allauth?
How to have incremental auth for google provider using django-allauth
hi
i am using sublime text 3 and using flask but these red lines are showing any1 know how to remove these underlines
if
@glad patrol are you paying the license ??
my bootstrap collapsible navbar button just doesn't work at all. i checked network, bootstrap JS is loading and its loaded before bootstrap, data targets look good, no clue whats going on. the elements dont even get enabled.
<nav class="navbar navbar-expand-lg navbar-dark bg-darkest">
<a class="navbar-brand mr-4 text-weight-bold text-secondary" href="{% url 'lance-home' %}">
<img class='img-fluid mx-3' src="{% static 'lance/lanceconsole.gif' %}" alt="" width="177" height="43">
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggler"
aria-controls="navbarToggler" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse text-light" id="navbarToggler">
<div class="navbar-nav mr-auto">
<a class="nav-item nav-link mx-1" href="{% url 'lance-home' %}">
<img alt="" class="icon-white w-25 mx-1" src="{% static 'lance/icons/home-1214326.png' %}">
home
</a>
<a class="nav-item nav-link mx-1" href="https://github.com/xsetrox">
<img alt="" class="icon-white w-25 mx-1" src="{% static 'lance/icons/github-1288230.png' %}">
github
</a>
<a class="nav-item nav-link mx-1" href="https://www.linkedin.com/in/lance">
<img alt="" class="icon-white w-25" src="{% static 'lance/icons/linkedin-1239440.png' %}">
linkedin
</a>
<a class="nav-item nav-link mx-1" href="https://instagram.com/lance">
<img alt="" class="icon-white w-25" src="{% static 'lance/icons/instagram-1239436.png' %}">
instagram
</a>
</div>
<!-- Navbar Right Side -->
<div class="navbar-nav">
</div>
</div>
</nav>
@rich warren nope
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.
i figured it out, apparently i was missing yet another js library even though the bootstrap site says theyre all included in the package i was loading
@past cipher Do you mean in django template or in cloudinary admin settings?
Currently I'm using custom model function which give me url with ext it doesn't have specified. But main problem in DB it still hasn't .ext in url
def get_cloudinary_img_jpg(self):
image = self.picture_preview.url
if image.endswith('.jpg'):
return self.picture_preview.url
else:
return self.picture_preview.url + '.jpg'
is using react with django plausible?
most people when using react will use django as a rest api (so django rest framework), if you want to use django and a js framework vue.js seems to be more favorable to use with django, but in the end everything is possible even using react with django
is anyone good at react router please tell me
Found annoying thing Django template method get_next_by_FIELD doesn't sort by published and return all objects. Any way to fix that?
anyone?
do you have a specific question?
this one #web-development message
?
@noble spoke when I press the home icon, I want it to take me to the message sender box in react router
Can someone guide me through openapi implementation in django
you can have your "/home" route to render that message box and the feed (if you have a feed)
something like
import React from "react";
import { BrowserRouter, Switch, Route } from "react-router-dom";
import { MessageBox } from "./wherever";
const App = () => {
return (
<BrowserRouter>
<div className="App">
<Switch>
<Route exact path="/home" render={() => <MessageBox />} />
</Switch>
</div>
</BrowserRouter>
)
}
Should we suppose to run manage startapp for every model or table
thats the sidebar tho, you want it rendered on every page
so you should put it outside of the <Switch>
<BrowserRouter>
<div className="App">
<Sidebar />
<Switch>
<Route exact path="/home" render={() => <MessageBox />} />
</Switch>
</div>
</BrowserRouter>
like that
I don't use Django, but should be similar. Here I how I save it with file extension:
def save_upload(self, upload_type):
if "torage: ''" in str(self.uploaded_file):
return None
upload_result = upload(self.uploaded_file, public_id=f'{self.generate_upload_id()}.{str(self.uploaded_file.filename).rsplit(".", 0)[0]}', resource_type="auto")
return cloudinary_url(upload_result['public_id'])[0]
import React from 'react'
import './Sidebar.css'
import SidebarOption from "./SidebarOption"
import HomeRoundedIcon from '@material-ui/icons/HomeRounded';
import EmojiPeopleRoundedIcon from '@material-ui/icons/EmojiPeopleRounded';
import PeopleRoundedIcon from '@material-ui/icons/PeopleRounded';
import ChatRoundedIcon from '@material-ui/icons/ChatRounded';
import SubscriptionsRoundedIcon from '@material-ui/icons/SubscriptionsRounded';
import NotificationsActiveRoundedIcon from '@material-ui/icons/NotificationsActiveRounded';
import ThumbUpRoundedIcon from '@material-ui/icons/ThumbUpRounded';
function Sidebar() {
return (
<div className= "sidebar">
<img className ="image"
src="Socio.png" alt=""></img>
<>
<SidebarOption active Icon={HomeRoundedIcon}text = "Home" />
<SidebarOption Icon={EmojiPeopleRoundedIcon}text = "Surf" />
<SidebarOption Icon={PeopleRoundedIcon} text = "Friends"/>
<SidebarOption Icon={ChatRoundedIcon} text = "Chat"/>
<SidebarOption Icon={SubscriptionsRoundedIcon} text = "Stories"/>
<SidebarOption Icon={NotificationsActiveRoundedIcon} text = "Notifications"/>
<SidebarOption Icon={ThumbUpRoundedIcon} text = "Liked Posts"/>
</>
</div>
)
}
export default Sidebar
can you show it on the code?
hi um i a having this problem
idk what is causing this
so can anyone tell what should i do to fix this
so i know if there is a problem with my code
thats not where you should change code, you should change it in your App.js
oh
anyone?
is there anyone here can help me in django?