mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-07-16 02:52:25 +03:00
More repo_name -> project_slug cleanup
This commit is contained in:
parent
7cb5c0bba4
commit
fb59c5117b
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -28,7 +28,7 @@ _build
|
||||||
|
|
||||||
# Project Specific Stuff
|
# Project Specific Stuff
|
||||||
local_settings.py
|
local_settings.py
|
||||||
repo_name
|
project_slug
|
||||||
my_test_project/*
|
my_test_project/*
|
||||||
|
|
||||||
# Generated when running py.test for the Cookiecutter Django generation tests
|
# Generated when running py.test for the Cookiecutter Django generation tests
|
||||||
|
|
|
@ -94,7 +94,7 @@ You'll be prompted for some values. Provide them, then a Django project will be
|
||||||
|
|
||||||
**Warning**: After this point, change 'Daniel Greenfeld', 'pydanny', etc to your own information.
|
**Warning**: After this point, change 'Daniel Greenfeld', 'pydanny', etc to your own information.
|
||||||
|
|
||||||
**Warning**: repo_name must be a valid Python module name or you will have issues on imports.
|
**Warning**: project_slug must be a valid Python module name or you will have issues on imports.
|
||||||
|
|
||||||
Answer the prompts with your own desired options_. For example::
|
Answer the prompts with your own desired options_. For example::
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ Answer the prompts with your own desired options_. For example::
|
||||||
Receiving objects: 100% (550/550), 127.66 KiB | 58 KiB/s, done.
|
Receiving objects: 100% (550/550), 127.66 KiB | 58 KiB/s, done.
|
||||||
Resolving deltas: 100% (283/283), done.
|
Resolving deltas: 100% (283/283), done.
|
||||||
project_name [project_name]: Reddit Clone
|
project_name [project_name]: Reddit Clone
|
||||||
repo_name [Reddit_Clone]: reddit
|
project_slug [Reddit_Clone]: reddit
|
||||||
author_name [Your Name]: Daniel Roy Greenfeld
|
author_name [Your Name]: Daniel Roy Greenfeld
|
||||||
email [Your email]: pydanny@gmail.com
|
email [Your email]: pydanny@gmail.com
|
||||||
description [A short description of the project.]: A reddit clone.
|
description [A short description of the project.]: A reddit clone.
|
||||||
|
|
|
@ -19,9 +19,9 @@ Then install the requirements for your local development::
|
||||||
|
|
||||||
.. _virtualenv: http://docs.python-guide.org/en/latest/dev/virtualenvs/
|
.. _virtualenv: http://docs.python-guide.org/en/latest/dev/virtualenvs/
|
||||||
|
|
||||||
Then, create a PostgreSQL database with the following command, where `[repo_name]` is what value you entered for your project's `repo_name`::
|
Then, create a PostgreSQL database with the following command, where `[project_slug]` is what value you entered for your project's `project_slug`::
|
||||||
|
|
||||||
$ createdb [repo_name]
|
$ createdb [project_slug]
|
||||||
|
|
||||||
`cookiecutter-django` uses the excellent `django-environ`_ package with its ``DATABASE_URL`` environment variable to simplify database configuration in your Django settings. Now all you have to do is compose a definition for ``DATABASE_URL``:
|
`cookiecutter-django` uses the excellent `django-environ`_ package with its ``DATABASE_URL`` environment variable to simplify database configuration in your Django settings. Now all you have to do is compose a definition for ``DATABASE_URL``:
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ Project Generation Options
|
||||||
project_name [project_name]:
|
project_name [project_name]:
|
||||||
Your human-readable project name, including any capitalization or spaces.
|
Your human-readable project name, including any capitalization or spaces.
|
||||||
|
|
||||||
repo_name [project_name]:
|
project_slug [project_name]:
|
||||||
The slug of your project, without dashes or spaces. Used to name your repo
|
The slug of your project, without dashes or spaces. Used to name your repo
|
||||||
and in other places where a Python-importable version of your project name
|
and in other places where a Python-importable version of your project name
|
||||||
is needed.
|
is needed.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
repo_name = '{{ cookiecutter.project_slug }}'
|
project_slug = '{{ cookiecutter.project_slug }}'
|
||||||
|
|
||||||
if hasattr(repo_name, 'isidentifier'):
|
if hasattr(project_slug, 'isidentifier'):
|
||||||
assert repo_name.isidentifier(), 'Repo name should be valid Python identifier!'
|
assert project_slug.isidentifier(), 'Project slug should be valid Python identifier!'
|
||||||
|
|
|
@ -54,7 +54,7 @@ def test_default_configuration(cookies, context):
|
||||||
result = cookies.bake(extra_context=context)
|
result = cookies.bake(extra_context=context)
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
assert result.exception is None
|
assert result.exception is None
|
||||||
assert result.project.basename == context['repo_name']
|
assert result.project.basename == context['project_slug']
|
||||||
assert result.project.isdir()
|
assert result.project.isdir()
|
||||||
|
|
||||||
paths = build_files_list(str(result.project))
|
paths = build_files_list(str(result.project))
|
||||||
|
@ -72,7 +72,7 @@ def test_enabled_features(cookies, feature_context):
|
||||||
result = cookies.bake(extra_context=feature_context)
|
result = cookies.bake(extra_context=feature_context)
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
assert result.exception is None
|
assert result.exception is None
|
||||||
assert result.project.basename == feature_context['repo_name']
|
assert result.project.basename == feature_context['project_slug']
|
||||||
assert result.project.isdir()
|
assert result.project.isdir()
|
||||||
|
|
||||||
paths = build_files_list(str(result.project))
|
paths = build_files_list(str(result.project))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user