GithubHelp home page GithubHelp logo

django_starter's Introduction

Django Starter Project

Python Django Black Code Linting Git Hooks

Running the Project (Local)

  • Get a copy of the local_settings from one of the developers.
  • Run database separately, either a docker container or a system service. It's not included as part of the project setup.
  • Change DATABASES in the local_settings file to connect to your database.
  • Create a python virtual env - python3 -m venv venv
  • Activate the environment - source venv/bin/activate
  • Install dependencies - pip install -r requirements.txt
  • Run - pre-commit install to enable pre-commit git hooks
  • Run migrations - python manage.py migrate
  • Run server - python manage.py runserver

Project Structure

There are following main directories:

1. apps. Contains all the apps of this project. All the configuration has been changed to identify the apps under this directory. To create an app, first create the directory inside apps, then run django-admin startapp <app_name> apps/<app_name>.

# From the root directory
> mkdir apps/<app_name>
> django-admin startapp <app_name> apps/<app_name>

2. apiserver. Contains all the configuration and settings.

apps

The code snippet in settings.py and present below ensures that the apps directory is treated as the parent of all the apps.

# Use apps directory as parent of all the apps
sys.path.insert(0, os.path.join(BASE_DIR, "apps"))

apiserver

All the configurations for the project are to be stored here. The current structure has the following configurations.

  1. wsgi.py - Sync server config
  2. asgi.py - Async server config
  3. urls.py - Root URL config
  4. settings/ - This directory contains all django and application related settings

Contact List


Development Checklist

  • You are not repeating the code, follow DRY (Do not Repeat Yourself)

  • Add logs as much possible. Use the configured logger to do the same with appropriate log level. Examples:

    """ My module """
    import logging
    logger = logging.getLogger(__name__)
    
    logger.info("My awesome message with %s", variable)
    logger.error("Some weird error %s", err_msg)
    logger.debug("I can show detailed debug-agnostic logs")
  • Add comments when you know that re-visiting particular snippet will need help and needs explanation.

  • Make sure that you install black as the formatter in your editor.

  • Refer this document to configure black in you editor

  • Git guidelines: Use Conventional Commits

django_starter's People

Contributors

camsvn avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.