Skip to content

kramarama/django-service-boilerplate

 
 

Repository files navigation

CircleCI

HowTo Use

Backend requirements:

  1. install pip -- https://pip.pypa.io/en/stable/installing/#installation
  2. install virtualenv -- https://virtualenv.pypa.io/en/stable/installation/#installation
  3. install virtualenvwrapper -- https://virtualenvwrapper.readthedocs.io/en/latest/install.html#installation (pip install virtualenvwrapper)
  4. install and run PostgreSQL and Redis
  5. install PhantomJS selenium driver (if you want to run selenium tests)

Ubuntu OS:

  1. install libcurl4-openssl-dev -- https://packages.ubuntu.com/xenial/libcurl4-openssl-dev (sudo apt-get install libcurl4-openssl-dev)
  2. install zlib1g-dev -- https://packages.ubuntu.com/ru/xenial/zlib1g-dev (sudo apt-get install zlib1g-dev)
  3. install postgis -- http://postgis.net/install/ (sudo apt-get install postgis)
  4. install libgdal-dev -- https://packages.ubuntu.com/xenial/libgdal-dev (sudo apt-get install libgdal-dev)
  5. install gdal -- https://pypi.python.org/pypi/GDAL (pip install gdal)

Create new project, virtualenv and install requirements:

git clone [email protected]:pik-software/<repo>.git <project-name>
cd <project-name>
mkvirtualenv --python=$(which python3.6) <project-name>
pip install -r requirements.txt  # install python requirements

Create file settings_local.py in _project_ and setup DATABASE and some local settings:

  DEBUG = True
  SECRET_KEY = '0n-w7wsf^3-ehi^!@m2fayppf7cc3k4j5$2($59ai*5whm^l7k'
  DATABASES = {
      'default': {
          'ENGINE': 'django.contrib.gis.db.backends.postgis',
          'NAME': '<project-name>',
          'USER': 'postgres',
          'PASSWORD': 'postgres',
          'HOST': 'localhost',
          'PORT': '5432'
      }
  }

Create and migrate database:

createdb <project-name>  # create postgres database
(OR sudo su postgres -c "createdb <project-name>")
python manage.py migrate

Run dev server:

python manage.py runserver

Database transfer with dumpfile:

# The command for create dumpfile (on localhost)
pg_dump -d <project-name> -h localhost -U postgres -W -Fc -x -O > dump.dmp

# The command for restore dump from file (on server)
pg_restore dump.dmp

About

Initial Django Microservice template

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 67.2%
  • HTML 26.7%
  • Shell 4.1%
  • JavaScript 1.5%
  • CSS 0.5%