Coder Social home page Coder Social logo

django-pure's Introduction

django-pure

image

Culmination of years of best practices accumulated using django on SAAS projects. No more reinventing the wheel, with cookiecutter we can consolidate our best practices.

Philosophy

  • 12 factor, with modifications:
      1. Dev/prod parity:
      Degrade gracefully: In absence of services on system, packages in environments, catch errors and continue to run. This way sites can be tested on local installations, staging systems without hacks.
  • Python 2.7+ and 3 compatible: Python 3.x ready
  • No frills: Leave the CSS / JS up to you. Only include the essentials.

Differences from django-admin startproject

startproject, django-admin startproject <project_name> [destination] is the tool provided in django to launch a new project.

The default project layout update in 1.4 fixed issues relating to imports in manage.py, dependencies, but allowed custom templates for starter projects that didn't agree with the new default layout.

django-pure incorporates the benefit of the new manage.py but keeps project-specific modules adjacent to manage.py. The ReadTheDocs.org Django Project follows this convention.

Here are the differences:

  • Name of first application:

    startproject: {{ project_name }}/{{ project_name }}

    django-pure: {{ project_name }}/core

  • ROOT_URLCONF, WSGI_APPLICATION and DJANGO_SETTINGS_MODULE locations:

    startproject: stores wsgi.py, urls.py and settings.py in first app.

    django-pure: stores in project root

  • BASE_DIR in settings:

    As a result of the structural change, BASE_DIR in settings.py:

    BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

    to:

    BASE_DIR = os.path.dirname(os.path.abspath(__file__))

  • Everything in Differences from django-admin startapp (startappdifferences).

    startproject: Doesn't include by {admin,tests,views}.py or migrations/ by default.

Layout comparision

django-admin startproject:

project_name
├── db.sqlite3
├── project_name
│   ├── __init__.py
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
└── manage.py

django-pure:

project_name
├── core
│   ├── admin.py
│   ├── __init__.py
│   ├── migrations
│   │   └── __init__.py
│   ├── models.py
│   ├── tests.py
│   └── views.py
├── db.sqlite3
├── manage.py
├── settings.py
├── urls.py
└── wsgi.py

Differences from django-admin startapp

Confusingly perhaps, django's default app created with django-admin startproject is not the same output as an app with django-admin startapp.

django-pure mixes in the views.py, tests.py, models.py and migrations/__init__.py into the core app.

More: startapp in django docs.

Layout comparision

django-admin startapp example (omitting core app):

project_name
├── second_app  <- mixed into ``startproject``'s <project_name>/<project_name> app
│   ├── admin.py
│   ├── __init__.py
│   ├── migrations
│   │   └── __init__.py
│   ├── models.py
│   ├── tests.py
│   └── views.py
└── manage.py

Split Requirements

Instead of a requirements.txt for the project, a folder, requirements/ is created with:

  • local
  • dev.txt
  • staging.txt
  • qa.txt
  • prod.txt

Split Settings

Just like Split Requirements, the settings are split between environments.

Continuous Integration

Unit test across databases and python versions with Travis CI.

Roadmap

  • No bootstrap / css / js frameworks.
  • Django 1.8
  • Python 2.7 + 3.4 support
  • Salt
  • Fabric -> Salt-SSH
  • Vagrant
  • Graceful degradation to sqlite in local instances.
  • Example tests using RequestFactory.
  • tmuxp configuration and bootstrap_env.py to launch CLI workspaces, as well as TDD.
  • License: MIT, use in your open source, personal or commercial projects as you see fit.

django-pure's People

Contributors

tony avatar

Stargazers

Leo Larkpor avatar ty 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.