Bob
but redirect method expects a url/template
Mahan
class OrderView(View): def get(self, request, pk): cart = Cart(request) if not request.user.is_authenticated: return redirect('account:register') if not cart.cart: return redirect('cart:cart') else: order = get_object_or_404(Order, id=pk) return render(request, 'orderdetail.html', {'order': order})
Bob
what's the error ur getting?
Mahan
what's the error ur getting?
no error just dont work
Bob
maybe ur if condition is not in right place?
dvd
Hello everyone. I am new here and need some help with a Django project. I started my app locally in windows and I have finished it . The problems come when I want to deploy the server for production. I am not getting the right information. Someone could help? Btw. I didnt use a venv, I read It's not mandatory to use it. I read your replies
dvd
I want to deploy the server in a Linux, Debian based PC. I could run it with runserver, but as I need to install a SSL certificate I have to deploy it for prod
Bob
I mean gunicorn to serve the app and nginx to reverse proxy
dvd
I tried it, but not getting good results. Maybe I am not following the right documentation/tutorials
dvd
Or I am missing some steps
deficiente ✙
Hi everyone!) I'm using django_ninja to write my api and a have slight a problem with authentification. I have ReferralUser model - that's the custom model that i want to use in my api. But for the admin panel i want to use built-in django user. How can i manage to do that?)
Данил
As I now Django can use only one Authentication model. But you can use relation one-to-one for your Models with extra fields.
Данил
Did you get?
deficiente ✙
I have one to one relation between Referral user and built-in user models, but it has blank and null True, because referral users can be registered from the website and they don't necessarily need separate django user to operate
deficiente ✙
deficiente ✙
I've read about specifying authentication backends in django, can i use it for my purpose?
deficiente ✙
It's a bad idea Just don't do that.
what is better to do instead? Because i already use referral user for my telegram bot, that will be linked with api
Morteza
Use only one model for users authentication, and specify extra fields for it, with groups or anything that fits your project.
Morteza
what is better to do instead? Because i already use referral user for my telegram bot, that will be linked with api
Use the django user model, as @Wisely456 said, you can even create a one to one model with extra fields.
Данил
Or use OOP instead relations
deficiente ✙
Use only one model for users authentication, and specify extra fields for it, with groups or anything that fits your project.
Thanks mate!) Will try your variant. So, in this case i just need to use built-in django user, inherit my custom model from it, add needed fields and just use my custom user model?
deficiente ✙
Or use OOP instead relations
Thanks) Had a thought about it
Morteza
Thanks mate!) Will try your variant. So, in this case i just need to use built-in django user, inherit my custom model from it, add needed fields and just use my custom user model?
Yes, also if your project is still in development mode, you can inherit AbstractUser to add new fields and customize it as you wish. ( You need a clean database to do it ).
deficiente ✙
@Wisely456 you too man)
cj
use any VPS
𝐊✞𝐚𝐧
Pythonanywhere if you looking for free host Heroku is good too ,but not for where we live
Anonymous
Which breadcrumb package would you recommend for Django when using class-based views?
Charly
Do some research on google mate.
Charly
Bingo!
Charly
Yeah you need to learn these things. There are no host solutions that require no learning.
Charly
It's a service it will last while you pay for it or you destroy it.
Charly
No, there is no such thing as pay once.
Charly
Use pythonanywhere is free
Charly
You won't have 1000 users. Don't overestimate your work.
Charly
So when you are ready to invest money you can use the paid plan of pytohn anywhere or another server.
Pavel
Hi everyone, please share examples of best practice tests for DRF on Pytest. I want to get good test coverage for my application and develop new functionality using TDD. Maybe someone of you have open repository with pretty tests, or some examples in your favorites.
Pavel
I find this repo very helpful though its outdated. https://github.com/ptrstn/django-testing-examples
Thank you, this is not what I’m looking for, here Django is clean, I want to see examples of DRF tests, I’ve already written a lot of tests, unit and integration, I want to see how others do the folder structure and see some tricks. Thank you for your attention:)
Shay
Hi folks, Can anyone tell me I created django app and the database used is sqlite. How to deploy and host it for free?
Shay
https://www.pythonanywhere.com/
Does it support sqlite db?
deficiente ✙
Hi folks, Can anyone tell me I created django app and the database used is sqlite. How to deploy and host it for free?
Hi) Here's an article on render that might be of use for you. Although, I wouldn't recommend to use sqlite database, it's better to use postgresql for example.
Shay
Okay
Pavel
Does it support sqlite db?
Yes, you can install it via pip
deficiente ✙
https://www.pythonanywhere.com/
Didn't use that, but heard of it, it's a good option too
Shay
Didn't use that, but heard of it, it's a good option too
I tried vercel, heroku but none of them support sqlite. Also I think python anywhere support mysql
deficiente ✙
I tried vercel, heroku but none of them support sqlite. Also I think python anywhere support mysql
I recommend you to use postgresql, because sqlite isn't used in production
Pavel
Didn't use that, but heard of it, it's a good option too
The best, try AWS, they give some services trial free for one year
deficiente ✙
So it would be great to learn how to work with postgre
Shay
I recommend you to use postgresql, because sqlite isn't used in production
I connected to postgre using railway.app But I am getting few errors
Pavel
Really. So hosting is also free?
https://youtu.be/TtcQMzKJb3Q?si=ki_mJqOLkYHGP-UL
Pavel
And for free dns you can use cloudfire
Данил
There is no free hosting. If VPS is free it doesn't fit to real work
Данил
You should use digital ocean for deploy through docker. Digital ocean also has articles for deploying
Данил
Railway, Versel, Flyio, Render , python anywhere. All of these are bad things for real work
Данил
By the way Versel is only for frontend developers as I know
Данил
If he wants stable work of his project, than have to use this
deficiente ✙
If he wants stable work of his project, than have to use this
Yeah, but they aren't free, digital ocean only gives 2 months of free trial
Shay
i don't think he is deploying commercial prod
No it's not for commercial use. Creating some personal projects. For demo purpose
deficiente ✙
No it's not for commercial use. Creating some personal projects. For demo purpose
Then you can use vercel or render for example, they are free.
Shay
Then you can use vercel or render for example, they are free.
Yes I have deployed in vercel but I don't understand why am I getting sqlite.db not found. Although I'm using postgres to connect now
.®️eza.
Hi there Does anyone know YouTube channels about Django that introduce the latest Django features and tricks?
deficiente ✙
Кошка
Does anyone have django roadmap to share?
Mirco
Ahmed
Is there any plane for django to support creating api without using third party framework like drf
Кошка
official doc u can find it
I mean django learning roadmap not django development roadmap
Mirco
I mean django learning roadmap not django development roadmap
There's no specific roadmap Start from basics thanks to tutorials on Django documentation and buy books from basics to avdance
Bhushan
Hii there How can i develop my business logic in django I have the understanding of django but now I am facing difficulty to develop my business logic
ᅠ ᅠ
Hello everyone, tell me how to add Python files to a Django project that do not belong to the project, but should work when called.
Anonymous
Hello I want to create a project with Celery and Django for my resume, but I have no idea Help 😅