Create a new Django project
NOTE: If you are using Django 1.x, you need to replace the python3 command with python.
The projects folder is located at /opt/bitnami/apps/django/django_projects.
Follow the steps below:
Change to your projects folder and run the following command to create a new project. Replace the PROJECT placeholder with the name of your project in this and all subsequent commands.
$ django-admin.py startproject PROJECT
If you wish to create a new application inside the project, execute the following commands as well. Replace the APP placeholder with the name of your application in this and all subsequent commands.
$ cd PROJECT $ python3 manage.py startapp APP
Edit the /opt/bitnami/apps/django/django_projects/PROJECT/APP/views.py file and add this content:
from django.http import HttpResponse def index(request): return HttpResponse("Hello world!")
Create the /opt/bitnami/apps/django/django_projects/PROJECT/APP/urls.py file and add these lines to it:
from django.conf.urls import url from . import views urlpatterns = [ url(r'^$', views.index, name='index'), ]
Edit the /opt/bitnami/apps/django/django_projects/PROJECT/PROJECT/urls.py file and modify it to look like this:
from django.conf.urls import url from django.urls import include urlpatterns = [ url(r'^APP/', include('APP.urls')), ]
If you have Django version 1.x use:
from django.conf.urls import url from django.conf.urls import include urlpatterns = [ url(r'^APP/', include('APP.urls')), ]
Follow the steps to deploy your Django project with Apache.
You should now be able to see your new application at http://SERVER-IP/PROJECT/APP.
If you prefer to use the standalone server in Django, refer to this section. Note that in this case, you will need to create an SSH tunnel to port 8000 (or the port configured for the standalone server) following these instructions. In this case, you should be able to see your new application at http://localhost:8000/APP.
To get started with Django, check the official Django documentation for the version that you are using.