Code Monkey home page Code Monkey logo

django-starter's Introduction

Django Starter

Go from a new environment to starting a Django project before your coffee cools!

I put all my Django best practices into this starter repository so you can start building right away.

This will help you:

  • Run tests and Django Security Check via GitHub Actions
  • Work faster with a self-documenting Makefile tailored to Django
  • Format files before committing with pre-commit
  • Get Python 3.9, Pip, Pipenv, and Django installed in a new environment
  • Work with a .gitignore tailored to Python and Django development
  • Set up and link a Docker Postgres database

Usage

1. Clone this repository

git clone https://github.com/victoriadrake/django-starter

2. Set your environment variables

./env-setup.sh

(It's always a good idea to read scripts before running them! If you don't, well, thanks for the Bitcoin.)

3. Install dependencies

Do make install to install dependencies in a virtual environment.

If you'd like help installing just Django via Pipenv, run ./django-setup.sh.

4. Profit!!!

You can now do make dev to see a pretty welcome page at http://localhost:8000/ and test that everything's working properly.

Start building! If you're new to Django, check out their great tutorials.

Run make help to see what else I've got set up for you.

What and why

Over the years I've been developing with Django, I've built up a suite of developer tools, practices that help make programmers more efficient, and lots of little tips and ideas that make building with Django easier.

I've written about a lot of these, and wanted to make it easier for you to use them too!

Automation

You can take advantage of automation to relieve developers of having to remember to run linting, tests, and other routine actions. The use of pre-commit and flows like GitHub Actions can help to keep your codebase consistent, tested, and easier to develop.

Settings and environments

Instead of the default settings.py, I use a settings directory with separate files for local and production environment settings. This helps avoid misconfiguration mishaps!

You can pass the settings file as an argument, for example when running the development server:

python manage.py runserver --settings=app.settings.local

The Makefile command make dev uses this. Speaking of...

A super helpful Makefile

Imagine having a super helpful, project-specific CLI that neatly remembers all your typical development actions for you. For example, instead of typing...

pipenv run coverage run python manage.py test app --verbosity=0 --parallel --failfast

You can just do:

make test

Isn't that better? I think so! Check out the self-documenting Makefile to see how it makes other everyday actions easier. (Why's it self-documenting? Just type make help and see.)

Contributing

Have something to add? Feel free to open a pull request!

django-starter's People

Contributors

victoriadrake avatar

Stargazers

 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.