No Name 😎🙍‍♂
isa
I think u will do with nginx config
Can you have any idea about it ?
Anonymous
How to redirect all HTTP connections to HTTPS in Django ?
RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
No Name 😎🙍‍♂
Can you have any idea about it ?
Which service do you use, digital ocean, aws ...
isa
That work done in cpanel
I dont have cpanel
Anonymous
https://mewnix.com/clientarea/aff.php?aff=380
Anonymous
https://mewnix.com/clientarea/aff.php?aff=380
Very good hosting with very good price
Nurkhan
Hello everyone! Is each request, that coming to application server is process or thread?
Amd64
pastebin down, apologies I will send again later
Shreehari
pastebin down, apologies I will send again later
try del.dog or ubuntu pastebin (Just suggesting, not advertising)
Amd64
https://pastebin.com/YQvYiVtn
Anonymous
i want to clear session of my application after 30 minutes can someone please guide me how
Sumit
i want to clear session of my application after 30 minutes can someone please guide me how
If you mean login session, then use password expire time to 30 min . Use django-user-accounts
Anonymous
Hello. I have strange problem for me Code: https://pastebin.com/AtciDDrE Exception: ValueError: Cannot assign "[<User: user>]": "PanelModel.user" must be a "User" instance. What i do wrong?
Jack
i want to clear session of my application after 30 minutes can someone please guide me how
SESSION_EXPIRE_AT_BROWSER_CLOSE = False SESSION_COOKIE_AGE = 30 * 60 Add these to settings.py
Sai Kumar
Does anyone know about accounting software about odoo
Doragonsureiyā
Does anyone know about accounting software about odoo
Looks like you need an offtopic group, please continue this conversation at @pythonofftopic as it's not related to Python
Mr. COwO2 Preis
is it a good idea to splitup every model class into a new app?
0x31c4ae1
is it a good idea to splitup every model class into a new app?
App is actually something like category for your models, URI and views. You can make separate apps for Users, Profile and Billing. Another one for Products, Categories and Cart. Or you can just build everything in a single app.
0x31c4ae1
okay thanks, but is there a rule of thumb how to group those categories? for example one app per domain (in domain-driven design)
That's very project-specific. For example if I'm building a Todo Application, I will create a "TodoRelated" app and place there TodoItem, Category and etc. But if I'm building an online-store, Category is product-related, so it should in the eponymous app.
Mirco
okay thanks, but is there a rule of thumb how to group those categories? for example one app per domain (in domain-driven design)
Think about apps as standalone thing. For example you can deploy an app that can be uploaded on PyPi and everyone can plug into their projects. It's something re-usable that can live in other projects to avoid reinventing the wheel
Enes
I was look for this library
Anonymous
✋! Could someone tell a django command to restart django app for production on the remote server? Right now I has access to remote server (through ssh connection and terminal window) and I have started virtual environment. I was trying to use python manage.py runserver and it worked, but I cannot close the console window and have the server running. And probably there should be some command to start the server (it was working and now I need just to restart it).
Anonymous
DON'T use runserver in Production!
I know that. But what do I have to use?
Mirco
Daphne or Uvicorn for async
Anonymous
>uWSGI probably the project is setup to work with that. Is there a special command or something? 👀
Mirco
There are tons of articles on internet about it
h
Just run it locally and Django will give you all u need It's easier if you cannot use a debugger
Hello, I tried to use debugger but as the project use docker file to setup and run the project i just wasn't able to use the debugger. I don't know i'm not getting anywhere on this issue. Thanks for your support, in case you are free please suggest something. Tried to google it and did some things but nothing.
Anonymous
There are tons of articles on internet about it
I was googling it for uWSGI and was not able to find command. Only a lot of useless (for my case) information about basic setup (which was already done by other developer, I just need command to make it run)
Anonymous
I am not from python world and not going to be just have to support some little project on django temporarly
Anonymous
Use Gunicorn, you are too confused to use uWSGI Gunicorn is simple to be ran
I am not pythonist. And neither do I plan to learn it. I just want to run this particular project that already was setup and that propaply use uWSGI.
Anonymous
found
cj
I was googling it for uWSGI and was not able to find command. Only a lot of useless (for my case) information about basic setup (which was already done by other developer, I just need command to make it run)
you don't need "a command", what you should have is to create a service unit —most Linux distros use systemd— and have it running on the background, you don't leave a command running there
cj
also I have wsgi.py file, maybe it's useful...
yes, gunicorn uses it to run the project
Anonymous
yes, gunicorn uses it to run the project
probably the project uses gunicorn.
Anonymous
yes, gunicorn uses it to run the project
Command 'gunicorn' not found, but can be installed with: apt install gunicorn
cj
Command 'gunicorn' not found, but can be installed with: apt install gunicorn
you'd better read this: https://docs.djangoproject.com/en/3.1/howto/deployment/
Anonymous
you'd better read this: https://docs.djangoproject.com/en/3.1/howto/deployment/
how could i understand which one method was use in the project?
cj
how could i understand which one method was use in the project?
99.9% Django projects use wsgi and most of them are deployed using gunicorn
cj
so you basically have to do: - Write a service unit —if the server uses systemd— to have gunicorn run the server - Use nginx to proxy-reverse the web server to the internet via a domain name (or IP)
Anonymous
so you basically have to do: - Write a service unit —if the server uses systemd— to have gunicorn run the server - Use nginx to proxy-reverse the web server to the internet via a domain name (or IP)
no, the solution must be more simple. Again, the project was already configured (and working!) but sometimes the server goes down for unknown reason and we need to manually restart it. We definitely use wsgi and probably not gunicorn (otherwise it would be installed).
cj
the if it was already configured, there must be a service unit already that you can restart using systemctl restart <unit_name>
cj
you just have to find out what is the unit_name used by the project
cj
or contact your SysAdmin, he must know things about that project and can guide you
Mirco
no, the solution must be more simple. Again, the project was already configured (and working!) but sometimes the server goes down for unknown reason and we need to manually restart it. We definitely use wsgi and probably not gunicorn (otherwise it would be installed).
Doing a deployment without having a minimum of knowledge of it will make you mad and the quality of your app will be very low for the users If you have to restart lots of times, something is going wrong
Anonymous
wsgi is a file that gunicorn uses to run the server
ok, I've installed gunicorn and ran the project using it. The project works, but I still cannot close the terminal window, otherwise the server isn't running...
cj
ok, I've installed gunicorn and ran the project using it. The project works, but I still cannot close the terminal window, otherwise the server isn't running...
then read again all the messages me and Mirco wrote and realize what you have to do 🤷🏻‍♂️ we won't run in circles with you here as we already told you what to do
Anonymous
or contact your SysAdmin, he must know things about that project and can guide you
she's not available now and the project is down, users are waiting right now 😅😅😅😅
cj
she's not available now and the project is down, users are waiting right now 😅😅😅😅
then find a way to contact the SysAdmin ASAP, you are gonna lose more time running in circles 🤷🏻‍♂️
cj
and have a nice day 😊
Anonymous
Doing a deployment without having a minimum of knowledge of it will make you mad and the quality of your app will be very low for the users If you have to restart lots of times, something is going wrong
I know that We are rewriting the entire code base to different stack (typescript/Nest.JS) and I have no desire to learn python or django. Right now we have to use the existing project. After several months it will be changed.
Anonymous
Brrr... Now I understand how mad you are 😄 Anyway good luck!
finally it worked. Just two steps. Install gunicorn and run: gunicorn -b 0.0.0.0:8080 myproject.wsgi & thanks god I'm not gonna work with python ever in my life
Anonymous
Actually thank you all for the gunicorn & wsgi lead. It was helpful, could have spent several more hours!
h
Even if you use Docker, you can run the runserver as entrypoint and have all the DEBUG log
Now I'm getting this error https://dpaste.org/rWnB Basically it's saying that my SECRET_KEY is empty but I tried to change it with random secret key generator, tried to google it and follwed all steps still don't know what's happening.
Mirco
finally it worked. Just two steps. Install gunicorn and run: gunicorn -b 0.0.0.0:8080 myproject.wsgi & thanks god I'm not gonna work with python ever in my life
You know every language or framework is easy when you spend a bit of your time studying it to understand how it works I can tell you the same when I work with your next stack.
Anonymous
You know every language or framework is easy when you spend a bit of your time studying it to understand how it works I can tell you the same when I work with your next stack.
Nah, python is different for me. JS/TS is easy for me and it was so from the begginning. Actually I started to learn programming from python 5 years ago, but it wasnt good, I switched to js and everything went smoothly (I hate setting up the environment and stuff, and python have problems with versions, virtual environments and other, all of which js/ts lacks. Also one lang for back and front is ultimate advantage) I sincerely hope node.JS and Nest.JS will completely supersede python from backend Web development.
lucifer
Need some help in project. Stuck at authentication part.
~Ronnie
Hello guys. I'm trying to deploy my project to Heroku but before I even do so when I testserver it brings an error saying 'dj_database_url' is not defined. I did the pip install dj_database_url and in my settings.py file I imported dj_database_url. Your thoughts on what could be the reason.
Anonymous
Anyone wants book of django dm me