Code Monkey home page Code Monkey logo

django-base-project's Introduction

django-base-project

A base "scaffold" for a new Django (REST) project that some people - but mostly myself - find very handy. It's now Python 3 only.

Features

This heavily resembles my favourite workflow and tools, so some things will differ from 'normal' Django projects. It contains:

  • an 'apps' package directory, with a flattened Django base project structure (no repeating project-name);
  • a 'settings' package/directory. Base settings are in settings/init.py, and can be overridden/expanded in environment-based settings-files, for example settings/development.py. An environment-file containing the name of the environment is expected. See 'getting started' below. I guess it's a bit like https://code.djangoproject.com/wiki/SplitSettings#SimplePackageOrganizationforEnvironments, but simpler.
  • a 'main' app, containing useful model-mixins and a default viewset;
  • a base 'articles' app;
  • a basic 'menus' app, using MPTT for the tree-structure (https://github.com/django-mptt/django-mptt) together with django-suit its SortableModelAdmin;
  • a shiny django-suit admin (http://djangosuit.com/):
    • AdminSite override, showing a custom admin 'home' (apps/main/admin_site.py);
    • Basic site-wide 'Latest Actions' admin functionality (not per user);
  • an admin list-display for the internal django admin-log (extended Latest Actions stuff);
  • django-rest-camel for DRF renderers/parsers; automatic camelcase to snake-case (and vice-versa) conversion;
  • JSON webtoken authentication (using djangorestframework-jwt);
  • basic invoke commands for local development (inv run!), see tasks.py;

Requirements/dependencies

Base tools, including django-extensions, django-suit, pip-tools, bpython, invoke, etc; Check out https://github.com/jazzband/pip-tools if you're unfamiliar with pip-tools. Then have a look at requirements.in for base requirements. The default development settings contain mysql-settings. Change to your liking.

  • runserver_plus for development, gunicorn for staging/production;

Getting started

  • Create a new virtualenv with Python3: $ virtualenv --python=python3 <env-name>;
  • Install pip-tools and invoke: $ pip install pip-tools invoke;
  • Clone/download/archive this repository and cd into it;
  • Create your environment file, for instance 'development': $ echo "development" > environment;
  • Edit the corresponding settings/development to your liking (database-settings, etc...);
  • Install base requirements: $ inv pip;
  • run $ inv migrate;

Notes

TODO

  • Menus app tests

django-base-project's People

Contributors

rense avatar wo0dyn 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.