From 44814f3cedbf15cc0bbf2adaee4f9e436fe69fb2 Mon Sep 17 00:00:00 2001 From: Daniel Roy Greenfeld Date: Fri, 18 Sep 2015 10:55:06 -0700 Subject: [PATCH] Add FAQ and early work on file copier #335 --- docs/faq.rst | 15 +++++++++++++++ docs/index.rst | 1 + hooks/post_gen_project.py | 26 ++++++++++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 docs/faq.rst diff --git a/docs/faq.rst b/docs/faq.rst new file mode 100644 index 00000000..9079aaee --- /dev/null +++ b/docs/faq.rst @@ -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 diff --git a/docs/index.rst b/docs/index.rst index 42f95754..0b876a18 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -20,6 +20,7 @@ Contents: live-reloading-and-sass-compilation deployment-on-heroku deployment-with-docker + faq Indices and tables ================== diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index e7ef8342..21432ffd 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -3,6 +3,9 @@ Does the following: 1. Generates and saves random secret key 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 utilities, specifically: @@ -13,6 +16,8 @@ import os import random import shutil +from cookiecutter.config import DEFAULT_CONFIG + # Get the root project directory PROJECT_DIRECTORY = os.path.realpath(os.path.curdir) @@ -82,9 +87,30 @@ def remove_task_app(project_directory): ) 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 make_secret_key(PROJECT_DIRECTORY) # 2. Removes the taskapp if celery isn't going to be used if '{{ cookiecutter.use_celery }}'.lower() == 'n': remove_task_app(PROJECT_DIRECTORY) + +# 3. Copy files from /docs/ to {{ cookiecutter.repo_name }}/docs/ +# copy_doc_files(PROJECT_DIRECTORY)