To setup and install Django server on any of the cloud platforms, the recommended way is to setup a VM using the Django image available from the marketplace. Details below:
By default, the Django application can not be accessed from the remote hosts. So you will need to allow Django for external hosts. You can do it by adding your server IP in settings.py. Run the following command, change the mysite folder directory depending on where you’ve installed Django
sudo nano mysite/settings.py
Change the following line:
ALLOWED_HOSTS = [‘your-server-ip’] – Make sure to add the quotations ‘ ‘
Save and close the file. Then, start the Django application with the following command:
Make sure you’re still in your Django root application folder.
python3 manage.py runserver 0.0.0.0:8000
You should see the following output:
Django application has now started and runs on port 8000.
Go to your ServerIP:8000 and you should see the following page:
To use the administrative web admin, Access with /admin
Login with username and password which was setup earlier.
Thats it, you’re now ready to start building your first app.
Django Documentation / Support
Documentation on using Django can be found on the official website:
Disclaimer: Django is a registered trademark owned by Django Software Foundation (DSF) and is licensed under BSD license. No warrantee of any kind, express or implied, is included with this software. Use at your risk, responsibility for damages (if any) to anyone resulting from the use of this software rest entirely with the user. The author is not responsible for any damage that its use could cause.
Cloud Solution Architect. Helping customers transform their business to the cloud. 20 years experience working in complex infrastructure environments and a Microsoft Certified Solutions Expert on everything Cloud.