Step 1. Prepare your envoirment

We start from:

  • apt-get update

Then we need to install required packages:

  • apt-get install python3-setuptools python3-dev python3 build-essential -y

After that we can begin with PIP installation:

  •  apt-get install python3-pip -y

Then we can download and install required files by our script. We need to switch catalogs where you have unziped upgrader files, in our case that will be:

  • cd /home/demo/upgrader-django

Now we can install required files:

  • pip3 install -r requirements.txt

Now we need to install PostgreSQL, we will not explain every step with envoriment installation, so you can learn something about server administration 🙂 We recommend to use official guide for PostgreSQL:

https://www.postgresql.org/docs/9.3/static/

After PostgreSQL is installed we can edit config file which is located in our case:

  • /home/demo/upgrader-django/upgrader_django/settings/production.py

You need to edit database settings to the ones you have made during PostgreSQL setup:

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'USER': 'upgrader',
'NAME': 'upgrader',
'PASSWORD': '12qw',
'HOST': '127.0.0.1',
'PORT': '5432',
},
}

Now we can migrate database from files to our PostgreSQL so:

  • python3 manage.py makemigrations
  • python3 manage.py migrate --settings=upgrader_django.settings.production

Now we can test our setup using:

  • python3 manage.py runserver 0.0.0.0:8000 --settings=upgrader_django.settings.production

If you made everything correctly you will be able to see Upgrader in your browser going to yourserverip:8000

This tutorial is not fully. In next one we will explain how to configure NGINX with Supervisor so you can put your upgrader script under own domain 🙂

 

 

 

 

%d bloggers like this: