mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-07-30 09:49:46 +03:00
smarter post_gen_project.py + Docker Remote Debugging instructions placeholder
This commit is contained in:
parent
2f297cba7f
commit
a57af695cc
11
README.rst
11
README.rst
|
@ -37,7 +37,8 @@ Features
|
|||
* Pre configured Celery_ (optional)
|
||||
* Integration with Maildump_ for local email testing (optional)
|
||||
* Integration with Sentry_ for error logging (optional)
|
||||
* Docker support using docker-compose_ for dev (with debug) and prod
|
||||
* Docker support using docker-compose_ for dev (with debug) and prod (optional)
|
||||
* PyCharm "Run/Debug Configurations" for django, grunt and docker (optional)
|
||||
|
||||
.. _Hitch: https://github.com/hitchtest/hitchtest
|
||||
.. _Bootstrap: https://github.com/twbs/bootstrap
|
||||
|
@ -189,6 +190,14 @@ And then run::
|
|||
$ docker-compose up
|
||||
|
||||
|
||||
If you want to connect to python interpreter inside docker container with remote debbuger, you have to run different
|
||||
container with debug.yml (dev.yml has to be build first)::
|
||||
|
||||
$ docker-compose -f dev.yml build; docker-compose -f debug.yml up
|
||||
|
||||
|
||||
See `docker remote debugging instructions <{{cookiecutter.repo_name}}/docs/docker_remote_debugging.rst>`_ for particular IDE (PyCharm, etc).
|
||||
|
||||
To migrate your app and to create a superuser, run::
|
||||
|
||||
$ docker-compose run django python manage.py migrate
|
||||
|
|
|
@ -4,43 +4,54 @@ import shutil
|
|||
|
||||
project_directory = os.path.realpath(os.path.curdir)
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
def clean(items):
|
||||
for item in items:
|
||||
path = os.path.join(project_directory, item)
|
||||
if os.path.isdir(path):
|
||||
shutil.rmtree(path)
|
||||
else:
|
||||
os.remove(path)
|
||||
|
||||
pycharm = '{{cookiecutter.use_pycharm}}' == 'y'
|
||||
docker = '{{cookiecutter.use_docker}}' == 'y'
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
docker_files = [
|
||||
'debug.yml',
|
||||
'dev.yml',
|
||||
'docker-compose.yml',
|
||||
'Dockerfile'
|
||||
]
|
||||
|
||||
docker_dirs = [
|
||||
'Dockerfile',
|
||||
'compose/',
|
||||
]
|
||||
|
||||
if not docker:
|
||||
for path in docker_files:
|
||||
os.remove(os.path.join(project_directory, path))
|
||||
|
||||
for path in docker_dirs:
|
||||
shutil.rmtree(os.path.join(project_directory, path))
|
||||
|
||||
clean(docker_files)
|
||||
# ------------------------------------------------------------------------------
|
||||
pycharm = '{{cookiecutter.use_pycharm}}' == 'y'
|
||||
|
||||
pycharm_files = [
|
||||
|
||||
]
|
||||
|
||||
pycharm_dirs = [
|
||||
'.idea/',
|
||||
]
|
||||
|
||||
pycharm_docker_files = [
|
||||
'.idea/Docker__createsuperuser.xml',
|
||||
'.idea/Docker__grunt_build.xml',
|
||||
'.idea/Docker__grunt_compass.xml',
|
||||
'.idea/Docker__grunt_serve.xml',
|
||||
'.idea/Docker__grunt_start_email_server.xml',
|
||||
'.idea/Docker__grunt_stop_email_server.xml',
|
||||
'.idea/Docker__grunt_watch.xml',
|
||||
'.idea/Docker__migrate.xml',
|
||||
'.idea/Docker__runserver_plus.xml',
|
||||
'.idea/Docker__runserver.xml',
|
||||
'.idea/Docker__tests___all.xml',
|
||||
'.idea/Docker__tests___class__TestUser.xml',
|
||||
'.idea/Docker__tests___file__test_models.xml',
|
||||
'.idea/Docker__tests___module__users.xml',
|
||||
'.idea/Docker__tests___specific__test_get_absolute_url.xml',
|
||||
'.idea/Docker__tests___users.xml',
|
||||
]
|
||||
|
||||
if not pycharm:
|
||||
for path in pycharm_files:
|
||||
os.remove(os.path.join(project_directory, path))
|
||||
|
||||
for path in pycharm_dirs:
|
||||
shutil.rmtree(os.path.join(project_directory, path))
|
||||
|
||||
clean(pycharm_files)
|
||||
elif pycharm and not docker:
|
||||
clean(pycharm_docker_files)
|
||||
# ------------------------------------------------------------------------------
|
||||
|
|
|
@ -279,6 +279,7 @@ You can then deploy by running the following commands.
|
|||
ssh -t dokku@yourservername.com dokku run {{cookiecutter.repo_name}} python manage.py createsuperuser
|
||||
|
||||
When deploying via Dokku make sure you backup your database in some fashion as it is NOT done automatically.
|
||||
{% if cookiecutter.use_docker == 'y' %}
|
||||
|
||||
Docker
|
||||
^^^^^^
|
||||
|
@ -394,3 +395,4 @@ If you want to scale your application, run::
|
|||
|
||||
|
||||
**Don't run the scale command on postgres or celerybeat**
|
||||
{% endif %}
|
||||
|
|
11
{{cookiecutter.repo_name}}/docs/docker_remote_debugging.rst
Normal file
11
{{cookiecutter.repo_name}}/docs/docker_remote_debugging.rst
Normal file
|
@ -0,0 +1,11 @@
|
|||
Docker Remote Debugging
|
||||
=======================
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque lobortis pharetra rutrum. Nulla finibus metus eget egestas facilisis. Sed non turpis at neque rhoncus vestibulum. Duis tristique augue nibh, at rhoncus orci vulputate ut. Aenean auctor vel magna nec pellentesque. Cras porta vestibulum tortor in sodales. Phasellus tempor arcu et mi faucibus, vel finibus massa tristique.
|
||||
|
||||
Proin vestibulum placerat orci ac ultricies. Pellentesque consectetur enim eget ex convallis, ut volutpat felis tincidunt. Sed magna purus, fringilla vitae lectus mattis, finibus hendrerit sapien. Mauris aliquam arcu maximus quam eleifend, sit amet aliquet orci porta. Nulla facilisi. Nulla pharetra augue pellentesque mauris consequat, sed porta magna accumsan. Etiam eget neque eget dolor feugiat rhoncus.
|
||||
|
||||
PyCharm
|
||||
^^^^^^^
|
||||
|
||||
Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae tellus eros. Etiam faucibus consectetur sem, in pharetra mi semper sed. Proin dignissim orci eget ante pulvinar semper. Mauris scelerisque gravida elit vitae dapibus. Morbi tincidunt leo vulputate, ornare ipsum vel, gravida purus. Mauris sed commodo ex. Fusce id enim arcu. Phasellus ultricies lorem nulla, vitae luctus mauris lobortis a. Aenean ac mauris ut neque semper egestas. Nullam ac elementum nunc.
|
Loading…
Reference in New Issue
Block a user