Skip to content

Commit

Permalink
replace app_name with application name in names of directories as well
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Nedbaylo authored and trbs committed Jan 6, 2010
1 parent ba0ce86 commit c18b8ff
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions django_extensions/management/commands/create_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,19 @@ def copy_template(app_template, copy_to, project_name, app_name):
# walks the template structure and copies it
for d, subdirs, files in os.walk(app_template):
relative_dir = d[len(app_template)+1:]
if relative_dir and not os.path.exists(os.path.join(copy_to, relative_dir)):
os.mkdir(os.path.join(copy_to, relative_dir))
d_new = os.path.join(copy_to, relative_dir).replace('app_name', app_name)
if relative_dir and not os.path.exists(d_new):
os.mkdir(d_new)
for i, subdir in enumerate(subdirs):
if subdir.startswith('.'):
del subdirs[i]
for f in files:
if f.endswith('.pyc') or f.startswith('.DS_Store'):
continue
path_old = os.path.join(d, f)
path_new = os.path.join(copy_to, relative_dir, f.replace('app_name', app_name))
path_new = os.path.join(d_new, f.replace('app_name', app_name))
if os.path.exists(path_new):
path_new = os.path.join(copy_to, relative_dir, f)
path_new = os.path.join(d_new, f)
if os.path.exists(path_new):
continue
path_new = path_new.rstrip(".tmpl")
Expand Down

0 comments on commit c18b8ff

Please sign in to comment.