I am just starting out on Django. I have successfully set it up and have it it talking to mysql and am ready to code . Inside of the eclipse IDE; should each app you are working have its own distinct server ( i.e my site) instance? Does it matter ?
generally each of your django PROJECTS (django-admin startproject) has its own server, project is the directory containing all your apps and contains the manage.py. each app ususally doesn't because a project is composed of apps.
For developing django includes a development server you can run using runserver
python manage.py runserver 0.0.0.0:8080
Related
How can I make my Django project accessible via internet?
When I execute the project in Windows OS by typing with a disabled firewall it works and reachable via the internet.
But in Linux OS it does not. I tried the same actions. Executed it by typing and made sure my firewall is disabled
python manage.py runserver 0.0.0.0:8000
The expected result is that project is accessible via the internet like in windows OS
you must deploy your app in one server. I recommend you pay for one VPS like digitalocean. And dont run you app with runserver. Runserver is only for development. Use one wsgi like gunicorn.
If you not want pay for this service. You can use heroku
https://devcenter.heroku.com/articles/deploying-python
I recommend use docker. Docker possibilite you development and deploy same envoriment
Django server name which is use to run app locally. As php use apache server to run app locally.
Django comes with its own development server, python manage.py runserver, which you would use to develop locally.
For more production-ready deployments, a popular choice is Nginx backed by uWSGI or Gunicorn.
It uses pure python built-in server
I have tried to start server with Django project like this:
python3.4 manage.py runserver 0.0.0.0:8000
and like this:
python3.4 manage.py runserver my_domain.com:8000
and it starts fine but I can't visit my site. Any ideas what I've done wrong?
The command python manage.py runserver is thought for development purposes.
If you have in mind to have a python (django in this case) website running in a remote server, try having a look at uwsgi.
It's an application server that plays really well with nginx.
Then, it could be possible run your site using the wsgi file in your django project:
uwsgi --http :8000 --module mysite.wsgi
In order to configure your django site, follow this documentation.
Also, if you plan to host more than one website, uwsgi has a emperor mode with slightly different configuration, but really worth for your VPS memory.
I am trying to deploy a django app on hostgator shared hosting. I followed the hostgator django installation wiki and i deployed my app. The issue is that i am getting a 500 error internal page when entering the site url in the browser. I contacted the support team but could not provide enough info on troubleshooting the error Premature end of script headers: fcgi.This was the error found on the server error log.
I am installed django 1.9.5 on the server and from the django documentation it does not support fastcgi.
So my question 500 error be caused by the reason that i am running django 1.9.5 on the server and it does not support fastcgi. if so do i need to install lower version of django to support the fastcgi supported by hostgator shared hosting
First i thought the error was caused by my .htaccess file but it has no issue from the what i heard from support team.
Any Leads to how i can get the app up and running will be appreciated. This is my first time with django app deployment. Thank you in advance
I know this is a while as to when i asked the question. I finally fixed this by changing the hosts. I went for Digital Oceans (created a new droplet) which supports wsgi. I deployed the app using gunicorn (application server) and nginx (proxy server).
It is not a good idea to deploy a Django app on shared hosting as you will be limited especially installing the required packages.
Many hostings today that support python use Phusion Passenger and I have been able to deploy Django on it successfully. Before I share the procedure, let me mention that I faced a lot of problems in doing this and now I have the solution to all of them. I have already written a step by step guide on my blog here to deploy a Django app on shared hosting.
Start a new python app in cpanel. Specify the url where you want the app to be and the folder where you want to put the contents of the app. Set the Application startup file to passenger_wsgi.py and the Application entry point to application.
Copy the command to enter the virtual environment and run it via online terminal in CPanel or SSH.
Install version 2.1 of Django (latest 2.2 will not work) pip install django==2.1
Upload your django project to the folder you specified while setting up the app. There will be a passenger_wsgi.py file in that folder. Edit it and enter the following code: (replace myapp with your application name)
from myapp.wsgi import application
Edit the settings.py file and add the url of your appp to the ALLOWED_HOSTS list.
Set up the MySql database
Configure the path for static files in the settings.py and run python manage.py collectstatic
Again go to Setup python app in cpanel and restart the app.
As you say, Django 1.9 does not support FastCGI.
You could try using Django 1.8, which is a long term support release and does still support FastCGI.
Or you could switch to a different host that supports deploying Django 1.9 with wsgi.
I'm trying to deploy my django app. I have it hooked up to an Ubuntu ec2 with bitnami on a amazon EC2 server.
1. How do I access my local deployment of the app inside my ec2?: I connect to my ec2 via my macbook terminal. I run python manage.py runserver inside the terminal and it says it's connected to the localhost of the ec2. Great. But how do I access the localhost of the ec2 at the 127.0.0.1:8000 website when I only can talk to it through terminal?
2. I'm having trouble setting up my templates: I keep getting the error Template does not exist
The template-loader postmortem showed:
Django tried loading these templates, in this order:
Using loader django.template.loaders.filesystem.Loader:
Using loader django.template.loaders.app_directories.Loader:
/opt/bitnami/apps/django/lib/python2.7/site-packages/Django-1.7.9-py2.7.egg/django/contrib/admin/templates/dashboard.html (File does not exist)
/opt/bitnami/apps/django/lib/python2.7/site-packages/Django-1.7.9-py2.7.egg/django/contrib/auth/templates/dashboard.html (File does not exist)
Thanks.
you want run your django web by python manage.py runserver.
then you should set your ec2 server ip for to make other computer access your django.
python manage.py runserver ***.***.***.***:80
then you can access
'***.***.***.***:80'
in your safari or chrome.
to answer your question, i need more detail.. like settings.py's template_dir or etc. template_loader check your settings.py;s template directory.