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
Related
I have a Django project. I tried to run develop SSL server by
python manage.py runserver_plus --cert-file cert.crt
But anytime I get error Site doesn't reach. How I can fix it? I have mapped my hosts.ics file, tried also a sslserver, but nothing is working.
I have a home server(OS: WindowsServer 2016 STD) with ip static and i want publish my Django project on a windows server from my home server.
What should i do to other people can access my project using my ip static!?
If you want to use it as development server then you can simply do:
python manage.py runserver 0.0.0.0 and then access it using your IP address.
Else you can follow this link to deploy Django on your Windows IIS server for production.
With django-extensions installed in your Django project, on a local machine you can use manage.py runserver_plus to have the very useful Werkzeug debugger active, so that the 500 error page lets you poke around with your stack interactively.
How do you activate the Werkzeug-enabled 500 page when running from Heroku?
If you are using gunicorn to serve your Django application on Heroku like on their tutorial https://devcenter.heroku.com/articles/django, you will not be able to see the Werkzeug debbuger because gunicorn does not use Werkzeug.
You have to serve you django application on Heroku using wsgi based server that uses Werkzeug like uWSGI. See -> https://github.com/unbit/uwsgi-docs/blob/master/tutorials/heroku_python.rst
Also DEBUG = True on your heroku settings must be set.
Having DEBUG = True on your production environment(heroku) is greatly discouraged because someone can view your settings(passwords) and even code.
I finally got apache2 with mod_wsgi working on Linux (havent much luck with windows :D) and everything works fine, but now when I added flatpages to my project, I found out that Apache doesn't seem to be aware of URL for admin when trying to create new flatpage via admin.
It says
Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1/admin/flatpages/flatpage/1/
And now I noticed that when I'm on admin front page, and hit F5 again and again, flatpages admin appears and disappears, but nothing like this happens when using dev server, so I'll try to create new project with default setting and see what it'll do in apache and in dev server, did anyone came across this kind of error?
The Django dev server auto-reloads your code when you change it, but Apache does not.
If you are running mod wsgi in daemon mode, you can reload the code by touching the wsgi script.
touch myproject/mysite.wsgi
Otherwise, you may have to restart apache. For example
/etc/init.d/apache2 restart
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.