django-source-code.zip
Django Source Code
media.zip
Media files zipped ( pictures, profiles)
postgresql_db.psql
Postgresql Database Dump
Project Framework: Django (Python 3.5.2)
Project Dependencies : ./MahilaPratinidhi-production/mahila_pratinidhi/requirements.txt
Database: psql (PostgreSQL) 9.5.24
You should have files django-source-code.zip
, media.zip
& postgresql_db.psql
.
Extract project source code as well.
Install python version 3.5.2
from package repository.
Setup python venv and create a virtual environment. See help here & here.
$ python3 venv/bin/activate
$ pip3 install -r requirements.txt
Install postgresql version 9.5.24
server from postgresql repository. See here.
Sample example:
sudo su - postgres
$ psql
psql> CREATE DATABASE myproject;
psql> CREATE USER myprojectuser WITH PASSWORD 'password';
psql> GRANT ALL PRIVILEGES ON DATABASE myproject TO myprojectuser;
Copy /MahilaPratinidhi-production/mahila_pratinidhi/mahila_pratinidhi/local_settings_sample.py
to create new local_settings.py
file. You should write your custom config in this file.
cp ./MahilaPratinidhi-production/mahila_pratinidhi/mahila_pratinidhi/local_settings_sample.py ./MahilaPratinidhi-production/mahila_pratinidhi/mahila_pratinidhi/local_settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': '',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
}
}
Update local_settings.py
with Database NAME
, USER
, PASSWORD
, HOST
, PORT
.
HOST
& PORT
is where your postgresql server is running.
Add entry to ALLOWED_HOSTS = ['mahilapratinidhi.naxa.com.np', 'mahilapratinidhi.com']
if you plan to allow other domains/subdomains or ip-address.
Change your SECRET_KEY
as well.
You might need to add your
webserver
IP address to ALLOWED_HOSTS as well. {.is-warning}
Un-dump the postgresql dump file ie postgresql_db.psql
to your new database.
unzip media.zip
to your .//MahilaPratinidhi-production/mahila_pratinidhi/
directory so that there everything is withing media
directory.
$ cd ./MahilaPratinidhi-production/mahila_pratinidhi/
$ python3 manage.py migrate
$ python3 manage.py collectstatic
$ python3 <path to your venv>/mahilaPratinidhi/bin/gunicorn -c gunicorn_config.py mahila_pratinidhi.wsgi
Django server should be now binded to 0.0.0.0:4113
.
Public
---> Nginx
----> Django