Closed Bug 1197186 Opened 9 years ago Closed 9 years ago

Split the project configuration files from the webapp django application

Categories

(Tree Management :: Treeherder, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mdoglio, Assigned: emorley)

References

Details

Attachments

(1 file, 1 obsolete file)

47 bytes, text/x-github-pull-request
mdoglio
: review+
Details | Review
The current project configuration is very confusing because it's embedded in a django application (treeherder.webapp). We should put the project-specific files (urls.py, wsgi.py, templates) in a separate folder and let webapp be a proper django application with its own static files and templates.
Assignee: nobody → mdoglio
Depends on: 1124382
Attached file PR 901 (obsolete) —
Attachment #8651759 - Flags: review?(emorley)
Status: NEW → ASSIGNED
Comment on attachment 8651759 [details] [review]
PR 901

Have left a comment + Travis is failing
Attachment #8651759 - Flags: review?(emorley)
Attachment #8651759 - Flags: review?(emorley)
Comment on attachment 8651759 [details] [review]
PR 901

Have left some comments :-)
Attachment #8651759 - Flags: review?(emorley)
Assignee: mdoglio → emorley
Depends on: 1212447
Depends on: 1212461
Mauro, could you advise what you intended the structure to be, now that we have additional static directories and also the persona_login.html file under webapp/templates/webapp/ ?

The current files are as follows:

treeherder/credentials/templates/credentials
treeherder/credentials/templates/credentials/base.html
treeherder/credentials/templates/credentials/credentials_confirm_delete.html
treeherder/credentials/templates/credentials/credentials_detail.html
treeherder/credentials/templates/credentials/credentials_form.html
treeherder/credentials/templates/credentials/credentials_list.html
treeherder/embed/static/embed
treeherder/embed/static/embed/css
treeherder/embed/static/embed/css/embed.css
treeherder/embed/templates/embed
treeherder/embed/templates/embed/resultset_status.html
treeherder/static/.gitkeep
treeherder/webapp/static/webapp
treeherder/webapp/static/webapp/css
treeherder/webapp/static/webapp/css/bootstrap.min.css
treeherder/webapp/static/webapp/fonts
treeherder/webapp/static/webapp/fonts/glyphicons-halflings-regular.eot
treeherder/webapp/static/webapp/fonts/glyphicons-halflings-regular.svg
treeherder/webapp/static/webapp/fonts/glyphicons-halflings-regular.ttf
treeherder/webapp/static/webapp/fonts/glyphicons-halflings-regular.woff
treeherder/webapp/static/webapp/fonts/glyphicons-halflings-regular.woff2
treeherder/webapp/static/webapp/js
treeherder/webapp/static/webapp/js/jquery-2.1.4.min.js
treeherder/webapp/templates/404.html
treeherder/webapp/templates/webapp
treeherder/webapp/templates/webapp/persona_login.html

I guess I'm not sure why the files under treeherder/webapp/static/webapp/ aren't under treeherder/static/webapp/ or even treeherder/credentials/static/webapp/ ?

In addition, I'm presuming persona_login.html is considered generic, so should be under treeherder/static/ in the new structure?

Thanks :-)
Flags: needinfo?(mdoglio)
Every django app can have its own static directory under version control; collectstatic iterates over the list of django applications and for each of them copies the content of their static folder to the project-wide static dir. This is defined in settings.STATIC_ROOT. Typically the content of settings.STATIC_ROOT is not under version control, as it gets populated at deploy time. At the moment settings.STATIC_ROOT points to treeherder/static/, so there shouldn't be anything inside under version control.
Things work differently for templates, where django iterates over the various apps templates folders to find the right template. You can also define a list of TEMPLATE_DIRS to scan in addition to that (although it's deprecated as of django 1.8, see https://docs.djangoproject.com/en/1.8/ref/settings/#template-dirs). We currently set it to treeherder/webapp/templates which is superfluous since treeherder.webapp is in INSTALLED_APPS. We could omit that in the settings file entirely.
Flags: needinfo?(mdoglio)
For what concerns persona_login.html it could either live in treeherder/webapp/templates or treeherder/templates if we add it to the list of TEMPLATE_DIRS.
Depends on: 1212822
No longer depends on: 1212461
No longer depends on: 1212447
Attached file PR 1048
Attachment #8651759 - Attachment is obsolete: true
Attachment #8671431 - Flags: review?(mdoglio)
Attachment #8671431 - Flags: review?(mdoglio) → review+
Commits pushed to master at https://github.com/mozilla/treeherder

https://github.com/mozilla/treeherder/commit/685b055d7a0825ab1e6c77d2f1e2566040877648
Bug 1197186 - Move the global templates directory outside of webapp/

Templates directories inside Django apps are automatically detected, so
we shouldn't set the global directory inside a Django app. 404.html is
generic enough to be in the global directory, persona_login.html is only
used by the 'webapp' Django app, so is being left as-is.

https://github.com/mozilla/treeherder/commit/a5999ac2b9c58dae659e5a7fd0222f976c213a6c
Bug 1197186 - Move wsgi.py to a generic config/ directory

Since it's not specific to the Django app 'webapp'.

https://github.com/mozilla/treeherder/commit/39b9656ac2d16014ad569212abba521ace7853a8
Bug 1197186 - Move whitenoise_custom.py to treeherder/config/

Since it's not specific to the Django app 'webapp'.

https://github.com/mozilla/treeherder/commit/49112e7d1223d2bd942e03d3985bbbe925019a45
Bug 1197186 - Move urls.py to treeherder/config/

Since it's the root URL config that include()s configs from the separate
apps, so should not be inside a Django app directory itself.

https://github.com/mozilla/treeherder/commit/8ae90719017f51a96f1ac0ffba9f481116fd7a44
Bug 1197186 - Move settings to treeherder/config/

Since they're not specific to the Django app 'webapp'.

Whilst we're there, the local & example settings files have been
renamed. In the future I'd like to combine settings_local.example.py
with puppet/files/treeherder/local.vagrant.py, but I'll do that in
another bug.
CCing a few people...

Note: This will require people to move `treeherder/settings/local.py` to `treeherder/config/settings_local.py` if they wish to keep using their local settings, and don't want the default given by a vagrant provision.
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: