jcalazan / django-project-template Goto Github PK
View Code? Open in Web Editor NEWTemplate to use when starting new Django projects
Template to use when starting new Django projects
This project is an awesome starter template. Thanks!
Maybe it would be a good idea to add some kind of library to handle your environment to activate different settings? Some popular examples: django-configurations
and django-split-settings
.
Here's a brief example, how to use django-split-settings
. We will need new settings
package structure:
your_project/settings/
├── __init__.py
├── components
│ ├── __init__.py
│ ├── database.py
│ ├── common.py
└── environments
├── __init__.py
├── development.py
├── local.py.template
├── production.py
└── testing.py
And here's settings/__init__.py
:
"""
This is a django-split-settings main file.
For more information read this:
https://github.com/sobolevn/django-split-settings
Default environment is `development`. To run app:
`python manage.py runserver`
To change the settings file:
`DJANGO_ENV=testing python manage.py runserver`
"""
from os import environ
from split_settings.tools import optional, include
ENV = environ.get('DJANGO_ENV') or 'development'
base_settings = [
'components/common.py', # standard django settings
'components/database.py', # database setup
'components/email.py', # smtp
# and any other components you need
# Select the right env:
'environments/%s.py' % ENV,
# Optionally override some settings:
optional('environments/local.py'),
]
# Include settings:
include(*base_settings)
So after that it would be crystal-clear for users where to put extra configurations like: django-debug-toolbar
and other which are used for development or testing only.
Pros:
Cons:
Maybe I am missing any cons, please correct me if I am wrong.
Here's a detailed article I wrote on this topic: https://medium.com/wemake-services/managing-djangos-settings-e2b7f496120d
So, what do you think?
In my computer, at least, with Python 3.4
My solution was to change
from base import *
to:
from project_name.settings.base import *
I did not make that change in a pull request because that might be happening by some stupidity of mine.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.