Skip to content
Pavel Burns edited this page Aug 28, 2020 · 2 revisions

Welcome to LKS Project Docs

  • This is project, blog and shop with the most modern technologies, also for testing new version of python and django.
  • This is just a pet project backend, this is not a boxed solution, this is just an API for my project.

Quick start

  1. Add "lks" to your INSTALLED_APPS setting like this::

     INSTALLED_APPS = [
         ...
         'lks',
     ]
    
  2. Include the polls URLconf in your project urls.py like this::

     path('lks/', include('lks.urls')),
    
  3. Run python manage.py migrate to create the lks models.

  4. Start the development server and visit http://127.0.0.1:8000/admin/ to create a lks (you'll need the Admin app enabled).

  5. Visit http://127.0.0.1:8000/lks/ to participate in the poll.

Project Install from repo

Clone project:

git clone -b develop https://github.com/63phc/lks.git
  • There are two ways to start a project, all in docker or only pg, redis in docker
  • You can not use docker, then you should have base and radis in local

Docker setup

  • Install Docker: instructions
  • edit docker/dev/.env file with your params
    cp .env.example .env
    docker-compose -f .docker/docker-compose.dev.yml build
    docker-compose -f .docker/docker-compose.dev.yml run backend python manage.py makemigrations
    docker-compose -f .docker/docker-compose.dev.yml run backend python manage.py migrate
    docker-compose -f .docker/docker-compose.dev.yml up

Start only postgres, redis

  • in file .env:6 need update POSTGRES_HOST=localhost
    docker-compose -f .docker/docker-compose.local.yml up postgresql redis

Create virtual env

  • VirtualEnv
python3 -m venv Venv
source Venv/bin/activate 
pip3 install -r src/requirements/development.txt
  • Or through pipenv:
pip3 install pipenv
pipenv install
pipenv shell

Env File

  • edit .env.example file with your params
cp .env.expamle .env
  • or create .env with params
var description
DJANGO_ENV ENUM: develop, test, production
SECRET_KEY
PROFILE
NGINX_PORT
POSTGRES_NAME
POSTGRES_USER
POSTGRES_DB
POSTGRES_PASSWORD
PGDATA
POSTGRES_HOST
POSTGRES_PORT
REDIS_HOST
REDIS_PASSWORD
REDIS_PORT
FLOWER_PORT
FLOWER_USER
FLOWER_PASSWORD
PROVIDER_EMAIL
EMAIL_HOST
EMAIL_PORT
EMAIL_HOST_USER
EMAIL_HOST_PASSWORD
SENDGRID_API_KEY
MAILGUN_API_KEY
FIXER_ACCESS_KEY
OPEN_EXCHANGE_RATES_APP_ID
SENTRY_DNS
  • Prepare project:
    python manage.py makemigration
    python manage.py migrate
    python manage.py createsuperuser
    python manage.py loaddata src/fixtures/*.json
    python manage.py runserver

Git flow

  • Easy git flow
    git checkout develop
    git pull develop
    git checkout -b <your branch>
    # when complete task
    git add .
    git commit -m '#<number task> commit messages' 
    git push origin <your branch>
    sudo pip3 install flake8
    #(OUTPUT FILTERS -> $FILE_PATH$\:$LINE$\:$COLUMN$\:.*)
    flake8 --install-hook git
    git config --global --bool flake8.strict true
    # Easy start -> ctrl + shift + a -> flake -> enter