https://github.com/audreyr/cookiecutter
A tool for creating a template for a Python project Prepare a project template using Django and Bootstrap, and use it like generating a project from the command line Some templates are published on GitHub etc.
pip install cookiecutter
cookiecutter https://github.com/audreyr/cookiecutter-pypackage.git
As for the specification of the template, it seems that the method is described in the explanation, so follow it. When creating a project, you will be asked for information such as the project name and email address, so if you answer, it will be reflected in the project. At this time, it seems that the repository is cloned in ~ / .cookiecutters. Maybe cache.
--Search with cookiecutter on GitHub --This is also Django https://www.djangopackages.com/grids/g/cookiecutter/
https://github.com/pydanny/cookiecutter-django Type that seems to be all in Since DB is PostgreSQL, change to MySQL and use The documentation is pretty well written
cd ~/dev
cookiecutter https://github.com/pydanny/cookiecutter-django.git
This time I will create a project in "home directory / dev" It doesn't matter if you ask the question properly. This time I will leave it as myassp Just be careful about the project name
Since the DB used is PostgreSQL, some settings are rewritten. ~/dev/myapps/requirements/base.txt Edit this file.
psycopg2==2.5.3 This line MySQL-python == 1.2.5 Change to
cd ~/dev/myapps
pip install -r requirements/local.txt
A text file that summarizes the necessary libraries is prepared, so use it to install In this template, the library can be divided according to the test environment, production environment, etc.
To requirements test.txt production.txt local.txt base.txt There is
base.txt is a common library for the whole, and the rest is divided into test / production / local
At this time, if I did it as it was, an error occurred in the PostgreSQL related library. Maybe it's because you didn't install it
Change DB config/settings.py DATABASES = values.DatabaseURLValue('postgres://localhost/myapps') Change this to one that uses MySQL
syncdb
python manage.py syncdb
Do normal syncdb However, there seems to be a model managed by south, and this alone does not complete
python manage.py migrate
This seems to pass the initial settings
python manage.py runserver
http://127.0.0.1:8000/
I didn't actually make it, but it's easy to fork someone's template and make it. If it's simple to play with, it's not so difficult, so it seems to be good for people who often make projects
――It looks good when you decide and operate a standard template etc. at a company etc. ――The created template can be a reference for implementation, but when it comes to using it, it can be awkward to understand first. ――You may need to make it only occasionally (because it requires labor and regular maintenance)
Recommended Posts