ajthr / django-boilerplate

Django Boilerplate including PostgreSQL as database, custom user model that uses email as username and dockerized. Based on Python, Django, PostgresSQL, Docker.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

License: MIT

django Boilerplate

A starting point for python-django websites and apis.

About

what does django-boilerplate include

  • Custom user model
    • A custom user model with email and password.
    • email is used as the username field.
  • Postgresql for db
    • Postgresql is configured and ready to be used.
    • custom commands for postresql.
  • Docker

Running the project

with docker

  • Open a command line window and go to the project's directory.
  • create a .env file and add environment variables.
    DB_ADMIN_USER=user
    DB_ADMIN_PWD=userpwd
    
  • setup docker container:
    docker build . && docker-compose build
  • Run the project:
    docker-compose up

without docker

  • make sure postresql is installed in the system.
  • clone repo and go to the project's directory.
  • install the dependencies:
    pip install -r requirements.txt
  • Run the migrations:
    python manage.py wait_for_db && python manage.py migrate
  • Run the project:
    python manage.py runserver

Helpful Commands

  • Make Migrations:
    docker-compose run --rm app sh -c "python manage.py makemigrations"
  • Create superuser:
    docker-compose run --rm app sh -c "python manage.py createsuperuser"
  • Run tests:
    docker-compose run --rm app sh -c "python manage.py test"

Note

Copyright (c) 2021 Ajith Ramachandran

MIT License

About

Django Boilerplate including PostgreSQL as database, custom user model that uses email as username and dockerized. Based on Python, Django, PostgresSQL, Docker.

License:MIT License


Languages

Language:Python 94.7%Language:Dockerfile 2.8%Language:Shell 2.5%