Skip to content

realestKMA/djangoup

Repository files navigation

Django Up

A template to quickly get up and coding your Django apps.

The Why, What & How

  • Why Djangoup ?

    As a Django developer, while starting a new project, i find myself doing the same thing over and over again. That is, setting up a docker environment for development, installing django, running the startproject command and more.

  • What will Djangoup accomplish ?

    The goal of this repo is to instantly spin up a django environment for development, with the following as key factors

    • Consistency.
    • Simplicity.
    • Ease of use.
  • How to use Djangoup

    At this point, it is safe to say you are familiar with Python & Django.

    Make sure to have docker and docker compose installed on your system, this will be needed as this project is designed to run in a docker environment. Please refer to Docker to get started with docker if you need to.

    • Create a virtual environment:
      python -m venv venv
    • Clone the contents of this repo into your new project directory. Make sure to add the (.) period sign after the url.
      git clone https://github.com/realestKMA/djangoup.git .
    • Install dependencies in the requirements file using pip:
      pip install -r requirements.txt
    • If you need to upgrade all packages in requirements.txt file do:
      pip-review --auto
    • create an .env file with data from the .env.sample and fill the required details:
      cp .env.sample .env
    • Build the docker compose file using the dev yaml file:
      docker compose -f docker-compose.dev.yml build
    • Bring up the docker compose file and start coding:
      docker compose -f docker-compose.dev.yml up

    Your project is now up and ready for development, you can now access it by visiting http://127.0.0.1:8000. Changes made while you code will automatically reflect on the docker instance.

Settings

Please note, the settings module has been split into three seperate modules as per my preferred use case inside the settings folder in the src project. These are

  • base module

    This module houses settings that span both development and production environment.

  • development module

    This module imports all settings from the base module. Here, i provide and/or make changes that is required for my development environment.

  • production module

    This module also imports all settings from the base module. Here, i provide and/or make changes that is required for my production environment.

Environment variables

Environment variables are referenced in the src/env.py module. This way, you can simply import the env module and do SECRET_KEY = env.SECRET_KEY

Database

To get up and coding your django apps, a postgres database has also been provided in the docker compose file. This will serve as the default database as specifeid in the development.py & production.py settings module.

Scripts

Few convenient bash scripts are provided

Docker

This folder contains the docker files per service if explicitly required.

Please

Make changes that suite your need. Thanks.

About

Django quick start template for development.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published