-
-
Notifications
You must be signed in to change notification settings - Fork 120
[CC-2] Django Init #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
cc_licenses/cc_licenses/settings.py
Outdated
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ | ||
|
||
# SECURITY WARNING: keep the secret key used in production secret! | ||
SECRET_KEY = "g*l49b_4r6dmvh9&=3u)qfv@s!%ln6jgvi)_wgstlmn#_egzpn" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we usually don't commit the SECRET_KEY
for our Django projects just so nobody deploys it accidentally with a key that's public. cc @aldenstpage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for catching this. Going to follow up with you about this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case it's OK to load the Django secret key from an environment variable without a default. Django fails to start if someone has forgotten to set it. We do the same with our own Django projects. https://github.com/creativecommons/cccatalog-api/blob/master/cccatalog-api/cccatalog/settings.py#L26
The Django secret key doesn't need to be shared between us, we can generate our own when we deploy it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aldenstpage and @kgodey, pushed changes addressing our conversation above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
A bunch of .pyc files got added to the PR. It's probably simplest to add pycache to .gitignore and then
git rm -r
all the pycache directories. -
I prefer not to nest the Django apps in a subdirectory of the repository, especially for a project that's not likely to ever get big. E.g. in https://github.com/creativecommons/cc-licenses/tree/CC-4-models I have a licenses app at the top level, alongside a cc_licenses package which has things like settings, urls.py, and wsgi.py. It's a matter of opinion, though.
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
exclude: '^deploy/' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we excluding deploy yaml files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we are not handling deployment, I didn't want to check those files @dpoirier. @aldenstpage, does CC use pre-commit
for running test/checks? Would you find it useful when @TimidRobot sets up SALT
to have those files checked/formatted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right, then we shouldn't have anything under deploy/ so no need to exclude it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dpoirier, pushed changes to address the bullet points above. I have removed licenses
app since we'll pull that in from your PR.
Merged into #2 |
This PR:
cc_licenses
(django project) andlicenses
(django app) to the repo.pre-commit
andcoverage
Makefile
for automating getting started