Skip to content

Commit

Permalink
Ensure that the target of STATIC_ROOT exists for freshly scaffolded
Browse files Browse the repository at this point in the history
    apps.

    Allow git add . to ensure the directory is created but doesn't add
    things we _know_ will exist there after running collectstatic.

    refs #803
  • Loading branch information
davidmiller committed Jul 29, 2016
1 parent 7bdcf2c commit 75e3f91
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
17 changes: 13 additions & 4 deletions bin/opal
Expand Up @@ -128,16 +128,25 @@ def startproject(args):
nix.mv(project_dir/'app', app_dir)

# 7. Create extra directories we need
js = app_dir/'assets/js/{0}'.format(name)
css = app_dir/'assets/css'
js = app_dir/'static/js/{0}'.format(name)
css = app_dir/'static/css'
js.mkdir()
css.mkdir()
nix.mv(app_dir/'static/js/app/routes.js', app_dir/'assets/js/{0}/routes.js'.format(name))
nix.rm_r(app_dir/'static')
nix.mv(app_dir/'static/js/app/routes.js', app_dir/'static/js/{0}/routes.js'.format(name))

templates = app_dir/'templates'/name
templates.mkdir()

assets = app_dir/'assets'
assets.mkdir()
assets_explainer = assets/'README.md'
assets_explainer << """
This placeholder file is here to ensure that there we still have our STATICFILES_DIRS target
if we commit generated code to source control.
This means that we can run collectstatic OK.
"""

# We have this here because it uses name from above.
def manage(command):
args = ['python', '{0}/manage.py'.format(name)]
Expand Down
8 changes: 7 additions & 1 deletion opal/scaffolding/scaffold/gitignore
@@ -1,7 +1,13 @@
*~
*.sqlite
*.pyc
static/*
*/assets/js/*
*/assets/css/*
*/assets/img/*
*/assets/admin/*
*/assets/rest_framework/*
*/assets/bootstrap*
*/assets/CACHE/*
.coverage
htmlcov
libpeerconnection.log

0 comments on commit 75e3f91

Please sign in to comment.