Skip to content

[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

Closed
wants to merge 9 commits into from
Closed

[CC-2] Django Init #1

wants to merge 9 commits into from

Conversation

Audiosutras
Copy link
Contributor

This PR:

  • Adds cc_licenses (django project) and licenses (django app) to the repo.
  • requirements directory
  • Test dependencies: pre-commit and coverage
  • Makefile for automating getting started

@Audiosutras Audiosutras requested a review from a team June 19, 2020 05:32
# 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"
Copy link
Member

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

Copy link
Contributor Author

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.

Copy link
Contributor

@aldenstpage aldenstpage Jun 19, 2020

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.

Copy link
Contributor Author

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.

Copy link
Contributor

@dpoirier dpoirier left a 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/'
Copy link
Contributor

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?

Copy link
Contributor Author

@Audiosutras Audiosutras Jun 22, 2020

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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.

@dpoirier
Copy link
Contributor

Merged into #2

@dpoirier dpoirier closed this Jun 23, 2020
@kgodey kgodey deleted the CC-2-django-init branch June 24, 2020 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants