raven
😁
raven
thanks, i'll try it.
you can use bulma or bootstrap as css framework .
Manish
How to store same input value three time with help of orm
Manish
@robbyoconnor??
Name
What is the best practice of storing env variables for Django project?
Name
.env with python module?
Jimmies San
What is the best practice of storing env variables for Django project?
for me: inject them from CI/CD during the build/deploy
Name
Thx
Shubham
I have created the registration API using allauth, and generated token, what should be the next step so that I can implement the signIn fuctionality https://github.com/shubham1507/school
Jesus
Hello, my name is Jesus and I come from Spain. Im currently developing a web app in Django but I am still a learner.
Jesus
I was wondering if there is any library or something that helps me create something like Dropbox but im much simpler way. At the moment, a user can upload one document and get a list of his documents. I would like to allow him to create folders and give some metadata to his files. Any suggestions?
Juris
Hello, Jesus. I'm also new to Django. I think you can: - Create a model for folders - Attach files to it - Create a folder web page html.
Jesus
Hello, Jesus. I'm also new to Django. I think you can: - Create a model for folders - Attach files to it - Create a folder web page html.
oh, yeah that was simple and useful! I also need to automatize this with some ajax, thank you again!
Juris
Welcome, and feel free to pm me Ajax tutorial/learning resources - should get on that myself!
Navruzbek
Hello people, can you suggest any good tutorial for lernign djangorest framework
Navruzbek
Mirco
thanks
Yw 😁
Anonymous
https://www.youtube.com/channel/UCiuZer2ELlG3dAhWCzwz9Og
Anonymous
I haven't seen his videos but I read his book which really helped me getting into Django
Maz
Man it's good to be back here. Hi folks. 👋
tz
hey guys, I am building my first API in django and I need little help
tz
anyone here have knowledge regarding this topic?
🏳️‍🌈Robby [ Private Message = Spam]
🏳️‍🌈Robby [ Private Message = Spam]
anyone here have knowledge regarding this topic?
https://www.django-rest-framework.org/
🏳️‍🌈Robby [ Private Message = Spam]
tz
when I test with Postman, it works fine
🏳️‍🌈Robby [ Private Message = Spam]
tz
but I cant fetch data from ajax
tz
lemme send you a ss
🏳️‍🌈Robby [ Private Message = Spam]
🏳️‍🌈Robby [ Private Message = Spam]
give a paste of the error https://dpaste.de
tz
error fron console log?
🏳️‍🌈Robby [ Private Message = Spam]
error fron console log?
or from your server
🏳️‍🌈Robby [ Private Message = Spam]
Because odds are you have an error there
🏳️‍🌈Robby [ Private Message = Spam]
or you're making requests incorrectly
tz
Bad Request: /fetch/ [25/Apr/2019 02:55:28] "GET /fetch/ HTTP/1.1" 400 7
🏳️‍🌈Robby [ Private Message = Spam]
Bad Request: /fetch/ [25/Apr/2019 02:55:28] "GET /fetch/ HTTP/1.1" 400 7
That's probably because you're not passing headers correctly, or not passing correct data period
tz
in ajax query?
tz
var settings = { "url": url, "method": "GET", "headers": { 'Accept': 'application/json', "Content-Type": "text/plain", }, "data": seconds, } $.ajax(settings).done(function (response) { console.log(response); });
🏳️‍🌈Robby [ Private Message = Spam]
in ajax query?
I don't know how your backend is setup
tz
@api_view(["GET"]) def fetch(seconds): try: with open('resources/backend.json') as f: miliseconds=json.loads(seconds.body)*1000.0 data=json.load(f) close=closest(data.keys(), miliseconds) index=data[str(close)] ans={"miliseconds":miliseconds, "closest":close, "index":index} return JsonResponse(ans) except: return Response("error", status.HTTP_400_BAD_REQUEST)
tz
my ajax call
tz
and view
🏳️‍🌈Robby [ Private Message = Spam]
Looks like you're hitting an exception — figure out why
tz
any idea where to look? because i'm messing from 2 hours :(
🏳️‍🌈Robby [ Private Message = Spam]
any idea where to look? because i'm messing from 2 hours :(
Log the exception and figure out why — rather than just returning a 400 response.
tz
okay thanks friend
🏳️‍🌈Robby [ Private Message = Spam]
it's pretty bad practice to just swallow an exception like this
🏳️‍🌈Robby [ Private Message = Spam]
Swallowing is bad, always spit.
tz
I'm doing for first time (i'll have to google how to log actually :P)
Name
using env vars or something like python-dotenv
Thx for your answer. But... Is the reason why not to use: FileEnvironment=/path/to/variables into gunicorn.service and get variables after from standard os.environ?
🏳️‍🌈Robby [ Private Message = Spam]
Thx for your answer. But... Is the reason why not to use: FileEnvironment=/path/to/variables into gunicorn.service and get variables after from standard os.environ?
It's easier to do this and more automated :) Specify your values in .env file and BAM it's loaded for ya in process.env
🏳️‍🌈Robby [ Private Message = Spam]
Both work
Name
Ok. Thx. Choose this way
Turtle_In_Hurry
Hello guys. i need to keep track of(or store) all information mailed to users is there any best way to do that in django apart from saving it in a model (database)
tz
Log the exception and figure out why — rather than just returning a 400 response.
$.ajax(settings).done(function (response) { console.log(response); });
🏳️‍🌈Robby [ Private Message = Spam]
$.ajax(settings).done(function (response) { console.log(response); });
That's not going to help you You need to log it on the server
🏳️‍🌈Robby [ Private Message = Spam]
You're not sending any useful information out in addition to the 400 error response.
tz
Sorry if this is too basic question, can you please elaborate or give me some study material
🏳️‍🌈Robby [ Private Message = Spam]
tz
thanks a lot
🏳️‍🌈Robby [ Private Message = Spam]
https://docs.python.org/3/howto/logging.html#logging-basic-tutorial
🏳️‍🌈Robby [ Private Message = Spam]
for example like how banks stores the transaction data of user?
Save it into a transaction record. The database is where you store this data — where the hell did you think you put this stuff?
Turtle_In_Hurry
oh you mean storing it into normal model would be the best option
Jimmies San
done ;)
🏳️‍🌈Robby [ Private Message = Spam]
tz
hey guys, I have a JS related problem but since it'd be off-topic for this group, please tell me if I can PM you...
tz
Ask here.
I have a json object which contains left-top and right-bottom co-ordinates of rectangular bounding box in the format [x1, y1, x2, y2] and some text. how can I make that rectangle and print the text inside it?
tz
Okay thanks
tz
I'm trying using canvas