How to deploy Django application to HostPresto!

Published 2021-02-12 18:26:13+00:00

In this tutorial we will deploy Django Polls project from official Django tutorial to the HostPresto!

If you have started learning Django framework, you should be familiar with this tutorial project. Moreover, you should have this project on your local machine up and running, using Django built-in development webserver. Now we will deploy this project to HostPresto!

If you do not have the project on your machine, you may just clone my GitHub repository:

https://github.com/vallka/django-polls/

(How to run the Polls project locally is out of scope of this tutorial. Please refer to official docs to set up local development environment and build the project: https://docs.djangoproject.com/en/3.0/intro/tutorial01/. )

Here we will assume that you have the project set up into your local virtual environment. The project should have the following or similar structure on your machine:

└───mysite
 │   db.sqlite3
 │   manage.py
 │   README.md
 │   requirements.txt
 ├───mysite
 │       settings-production.py.sample
 │       settings.py
 │       urls.py
 │       wsgi.py
 │       __init__.py
 ├───polls
 │   │   admin.py
 │   │   apps.py
 │   │   models.py
 │   │   tests.py
 │   │   urls.py
 │   │   views.py
 │   │   __init__.py
 │   ├───migrations
 │   │       0001_initial.py
 │   │       __init__.py
 │   ├───static
 │   │   └───polls
 │   │       │   style.css
 │   │       └───images
 │   │               background.jpg
 │   └───templates
 │       └───polls
 │               detail.html
 │               index.html
 │               results.html
 └───templates
     └───admin
             base_site.html

Let’s start to set up our HostPresto! Environment.

Creating subdomain

Suppose you have a domain registered with HostPresto! - yourname.xyz (BTW .xyz domains are the cheapest :). For this tutorial, we will create a subdomain polls.youname.xyz We think this is the most natural and straightforward method. Setting up the tutorial project in the root domain may pollute your space. You may also have some website sitting there already. Adding a subdirectory like www.youname.xyz/polls is less convenient, in our opinion.

Log in into cPanel and click on Subdomains in DOMAINS section. Enter ‘polls’ into Subdomain field. Select your main domain (youname.xyz) from Domain dropdown. Document Root will be auto populated with ‘polls.yourname.xyz’. Let’s accept the default value. Click Create.

Read more...

In this tutorial we will create a brand new Django application on HostPresto!

Let’s start to set up our HostPresto! Environment.

Creating subdomain

Suppose you have a domain registered with HostPresto! - yourname.xyz (BTW .xyz domains are the cheapest :). For this tutorial, we will create a subdomain start.youname.xyz We think this is the most natural and straightforward method. Setting up the tutorial project in the root domain may pollute your space. You may also have some website sitting there already. Adding a subdirectory like www.youname.xyz/start is less convenient, in our opinion.

Log in into cPanel and click on Subdomains in DOMAINS section. Enter ‘start’ into Subdomain field. Select your main domain (youname.xyz) from Domain dropdown. Document Root will be auto-populated with ‘start.yourname.xyz’. Let’s accept the default value. Click Create.

Read more...

1

2

3