django deployment using ubuntu ec2 (bitnami) - python

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.

Related

My Bitnami Django website shows the Bitnami homepage instead of mine. How to change it?

I deployed a website on AWS LIGHTSAIL. I assigned an static IP to that instance and when I enter to it, it shows me the Bitnami homepage.
When I run the virtual env in the Django project (python manage.py runserver 0.0.0.0:8000) I have to put the :8000 on my static IP for my website to shows up.
What I'm doing wrong? How do I make my website appears on the default port? Thanks!

Django AWS Elastic Beanstalk Deployment Successful but site not responsive

I'm trying to deploy my own API. I am using Django and the Django Rest Framework. I have uploaded my Django via Elastic Beanstalk Command Line Interface via eb init and eb create.
I am following this tutorial and have followed all of the steps:
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-django.html
I have successfully created my environment and uploaded my app:
However, when I hit up the url via eb open, this shows:
How do I debug something that tells me nothing is broken? I feel like something is off. My intuition tells me it has to do with me trying to serve my API over SSL. I currently have my Django app redirect all http requests to https. Do I have to run manage.py runsslserver? Do I need to install any environment things from my requirements.txt file?
EDIT: Normally when I run python manage.py runsslserver, I'm greeted with this on localhost. I have set up an api-root and expected to see that when I hit the EBS url.

Django app deployment on shared hosting

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.

Should each Django app have its own server instance?

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

django remote development server doesn't reload py file

I'm running django development server remotely using
python manage.py 0.0.0.0:8000
The project is available through Dropbox. I make the changes locally in my system and they are available to my testers when I checkin code to Dropbox folder.
The problem I'm facing is that the development server does not reload the code automatically. It somehow keeps running the same old code.
The development server on the same machine run on 127.0.0.1:8001 behaves as expected.
Is there a way to force reloading of files when django development server is run remotely?
Thanks for the help.

Categories

Resources