So I have a Django Project. Now I want to publish it but I have a few questions without answeres:
Normally if I want to make a change at my Django Project the Server needs to reload:
System check identified no issues (0 silenced).
May 12, 2021 - 21:07:20
Django version 3.1.5, using settings 'Project.settings'
Starting ASGI/Channels version 3.0.3 development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
If I want to change a running Server it will be stopped a few (Milli)seconds. Is this a bad behavior or is it the normal way to do it? :)
It is the normal way. The normal way for every kind of program mostly.
Related
i know i have seen similar questions on the issue but most of them seemed to be solved by allowing the port 8000 by using the command sudo ufw allow 8000. i have tried that but it is still not displaying when i visited my droplet_ipaddress:8000 link. i followed the official tutorials https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-22-04.
SYSTEM INFORMATION
OS = Ubuntu 22.04 LTS
Python = 3.10
Django = 4.0.4
the only difference with my work and the project process is that i did not build an dummy django project on my digitalocean vps rather i use git to clone my project repo and did the neccesary dependency installing using pip. Has anyone encountered the same problem and is there any solution.
when ever i ran python manage.py runserver 0.0.0.0:8000
the output is shown below as expected … but my page doesn't not display as expected
Performing system checks...
System check identified no issues (0 silenced).
You have 33 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): account, accounts, admin, ads, auth, chat, contenttypes, notification, payments, report, sales, sessions, sites, socialaccount.
Run 'python manage.py migrate' to apply them.
May 10, 2022 - 11:41:04
Django version 4.0.4, using settings 'ma_mall.settings.production'
Starting ASGI/Channels version 3.0.4 development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
when i visit the page its says
searching for the allowed port on the system gave this
which clearly shows the the port is now allowed to serve the app
In Digital Ocean, it is possible that you have a second firewall enabled that can be configured directly on the platform. You can find it under Droplet>Networking. Check if a firewall exists and adjust it for your port. Since two firewalls are a bit cumbersome and pointless, I would recommend using only the Digital Ocean firewalls and disabling ufw permanently via ufw disable.
I setup a clean django project with:
django-admin startproject newProject
cd newProject
python manage.py migrate
python manage.py runserver
January 29, 2019 - 00:30:02 Django version 2.1.2, using settings
'unchained.settings' Starting development server at
http://127.0.0.1:8000/
And navigate to http://127.0.0.1:8000/ with Google-Chrome (71.0.3578.98):
[29/Jan/2019 00:30:08] You're accessing the development server over HTTPS, but it only supports HTTP.
[29/Jan/2019 00:30:08] code 400, message Bad request version ('ÊÊÀ+À/À,À0̨̩À\x13À\x14\x00\x9c\x00\x9d\x00/\x005\x00')
[29/Jan/2019 00:30:08] You're accessing the development server over HTTPS, but it only supports HTTP.
So, at some point in the past I activated SSL with a totally unrelated project. And for some strange reason, chrome now expects HTTPS. I could probably fix it by deleting the browser cache, but I don't really want to loose all the data that is in there.
How would you solve this?
Django Development server only uses Http protocol instead of Https. Your site is being opened at https://127.0.0.1:8000/ instead of http://127.0.0.1:8000/
Go to settings .py and change
SECURE_SSL_REDIRECT = False
I am trying to host my Django App to Wamp in Windows 7. I already configured mod_wsgi correctly and had run a test project to verify it.
However, the server is really taking time to load as I migrated my dev project. I have read articles about optimizing mod_wsgi performance by enabling mod_wsgi daemon mode on non-Windows platforms.
My questions is: Is there a way to optimize mod_wsgi performance in Windows platform?
Side note: Its already 30 minutes since I have tried to access my django project and the page is still loading. There is no error log generated in Apache error log and the Wamp server is still running.
If it hangs indefinitely it is probably this issue:
http://modwsgi.readthedocs.io/en/develop/user-guides/application-issues.html#python-simplified-gil-state-api
This can be caused by certain third party Python modules which have C extensions, which have not been implemented properly so they work in Python sub interpreters.
Presuming your are only hosting the one WSGI application, add:
WSGIApplicationGroup %{GLOBAL}
I am learning python and Django now. I have a question related to deploying Django project on windows 7. I know how to start the test server in django and see the project. But I have to do start the server manually every time I restart the PC. Also I have to keep the terminal window open.
Consider the below scenario for php projects.
We copy and paste the php files in htdocs or www folder in apache server and access them using the respected url. Web Server is running in the background. We dont have to start the server on windows restart.
Is something similar possible with Django on apache or any other server?
If yes, how should I go about it?
Thanks in advance.
For anyone stumbling around for an answer to a similar problem with deploying Django on a Windows server, here is a guide
Deploy Django with Apache and mod_wsgi on Windows Server 2019
To have Apache24 service automatically run on startup, make the changes in Windows Services dialog.
Django development server keeps restarting itself, without any differences made to any files under the project directory.
Below is the output:
den#ev:~/calisma/ > python manage.py runserver 9000 -v 2 --traceback
Validating models...
0 errors found
Django version 1.1.1, using settings 'myproject.settings'
Development server is running at http://127.0.0.1:9000/
Quit the server with CONTROL-C.
Validating models...
0 errors found
Django version 1.1.1, using settings 'myproject.settings'
Development server is running at http://127.0.0.1:9000/
Quit the server with CONTROL-C.
Validating models...
0 errors found
Django version 1.1.1, using settings 'myproject.settings'
Development server is running at http://127.0.0.1:9000/
Quit the server with CONTROL-C.
Validating models...
0 errors found
Django version 1.1.1, using settings 'myproject.settings'
Development server is running at http://127.0.0.1:9000/
Quit the server with CONTROL-C.
^C
Most probably it does not like something somewhere in the project files
but couldn't get it choke out what's wrong.
Any suggestions?
Delete all the .pyc files
Use manage.py runserver --noreload
Try the same with an empty project. Or just disable all the INSTALLED_APPS setting.
How often does it reload? Inmediately, each X seconds, at random?
First ensure that the date of your computer is correctly configured (up to date) if it is not update it then retry to run the server.
If it still does not work I advise you to run the server with the option --noreload while waiting to find the solution but in my case that was exactly the same as the one meant set the date solved my problem.