Add FAQ and early work on file copier #335

This commit is contained in:
Daniel Roy Greenfeld 2015-09-18 10:55:06 -07:00
parent 275f7eee14
commit 44814f3ced
3 changed files with 42 additions and 0 deletions

15
docs/faq.rst Normal file
View File

@ -0,0 +1,15 @@
FAQ
====
Why aren't you using just one configuration file (12-Factor App)
----------------------------------------------------------------------
TODO
Why doesn't this follow the layout from Two Scoops of Django 1.8?
----------------------------------------------------------------------
You may notice that some elements of this project do not exactly match what we describe in chapter 3 of `Two Scoops of Django`_. The reason for that is this project, amongst other things, serves as a test bed for trying out new ideas and concepts. Sometimes they work, sometimes they don't, but the end result is that it won't necessarily match precisely what is described in the book I co-authored.
.. _`Two Scoops of Django`: http://twoscoopspress.com/products/two-scoops-of-django-1-8

View File

@ -20,6 +20,7 @@ Contents:
live-reloading-and-sass-compilation live-reloading-and-sass-compilation
deployment-on-heroku deployment-on-heroku
deployment-with-docker deployment-with-docker
faq
Indices and tables Indices and tables
================== ==================

View File

@ -3,6 +3,9 @@ Does the following:
1. Generates and saves random secret key 1. Generates and saves random secret key
2. Removes the taskapp if celery isn't going to be used 2. Removes the taskapp if celery isn't going to be used
3. Copy files from /docs/ to {{ cookiecutter.repo_name }}/docs/
TODO: this might have to be moved to a pre_gen_hook
A portion of this code was adopted from Django's standard crypto functions and A portion of this code was adopted from Django's standard crypto functions and
utilities, specifically: utilities, specifically:
@ -13,6 +16,8 @@ import os
import random import random
import shutil import shutil
from cookiecutter.config import DEFAULT_CONFIG
# Get the root project directory # Get the root project directory
PROJECT_DIRECTORY = os.path.realpath(os.path.curdir) PROJECT_DIRECTORY = os.path.realpath(os.path.curdir)
@ -82,9 +87,30 @@ def remove_task_app(project_directory):
) )
shutil.rmtree(task_app_location) shutil.rmtree(task_app_location)
# IN PROGRESS
# def copy_doc_files(project_directory):
# cookiecutters_dir = DEFAULT_CONFIG['cookiecutters_dir']
# cookiecutter_django_dir = os.path.join(
# cookiecutters_dir,
# 'cookiecutter-django',
# 'docs'
# )
# target_dir = os.path.join(
# project_directory,
# 'docs'
# )
# for name in os.listdir(cookiecutter_django_dir):
# if name.endswith('.rst') and not name.startswith('index'):
# src = os.path.join(cookiecutter_django_dir, name)
# dst = os.path.join(target_dir, name)
# shutil.copyfile(src, dst)
# 1. Generates and saves random secret key # 1. Generates and saves random secret key
make_secret_key(PROJECT_DIRECTORY) make_secret_key(PROJECT_DIRECTORY)
# 2. Removes the taskapp if celery isn't going to be used # 2. Removes the taskapp if celery isn't going to be used
if '{{ cookiecutter.use_celery }}'.lower() == 'n': if '{{ cookiecutter.use_celery }}'.lower() == 'n':
remove_task_app(PROJECT_DIRECTORY) remove_task_app(PROJECT_DIRECTORY)
# 3. Copy files from /docs/ to {{ cookiecutter.repo_name }}/docs/
# copy_doc_files(PROJECT_DIRECTORY)