jaymes15 / django-base-template

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Django, Docker template

Written with Django and DRF

Requirements to run this project using Docker

Getting started

To start project with Docker:

  • install docker
  • install docker-compose
  • Clone the project
  • Change directory to the project directory
  • Run:
        docker-compose up
  • The application would be available at http://127.0.0.1:8000

To start project without Docker using virtualenv:

  • Change directory to the project directory
  • create a virtualenv
  • activate the previously created virtualenv
  • Run:
        pip install -r <path_to_requirements.txt>
  • Change directory to the directory of manage.py file
  • Run to makemigrations:
        python manage.py makemigrations
  • Run to migrate:
        python manage.py migrate
  • Run to runserver:
        python manage.py runserver
  • The application would be available at http://127.0.0.1:8000

Project commands using docker

Start a new app:

docker-compose run --rm app sh -c "python manage.py startapp {app_name}"

Create superuser:

docker-compose run --rm app sh -c "python manage.py createsuperuser"

Makemigrations:

docker-compose run --rm app sh -c "python manage.py wait_for_db && python manage.py makemigrations"

To migrate:

docker-compose run --rm app sh -c "python manage.py wait_for_db && python manage.py migrate"

To makemigrations and migrate:

docker-compose run --rm app sh -c "python manage.py wait_for_db && && python manage.py makemigrations && python manage.py migrate"

To run test suites:

docker-compose run --rm app sh -c "python manage.py wait_for_db && python manage.py test"

To check lint:

docker-compose run --rm app sh -c "flake8"

To run tests and check lint:

docker-compose run --rm app sh -c "python manage.py wait_for_db && python manage.py test && flake8"

To install new packages:

Add the package name to requirement.txt file then run

docker-compose up --build

To tear down the all containers:

docker-compose down

isort:

docker-compose run --rm app sh -c "isort ."

About


Languages

Language:Python 86.8%Language:Dockerfile 9.9%Language:Shell 3.4%