-
Notifications
You must be signed in to change notification settings - Fork 0
Remove matomo, fix project build #14
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
Changes from all commits
04c43ec
df2597f
d129371
b79c716
144e179
9571536
81f7325
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,29 @@ | ||
| ## Usage | ||
|
|
||
| ### Option 1: From remote image (recommended) | ||
| Run this in whichever parent directory you'd like your project to live in. | ||
| ```bash | ||
| # Build cookiecutter container (Only need to do once) | ||
| # Build cookiecutter container to make sure it's up to date | ||
| docker build github.com/datamade/cookiecutter-django-app#main -t cookiecutter:latest | ||
|
|
||
| # Generate a new project | ||
| docker run -it \ | ||
| docker run --rm -it \ | ||
| --mount type=bind,source=$(pwd),target=/cookiecutter \ | ||
| cookiecutter gh:datamade/cookiecutter-django-app | ||
| ``` | ||
|
|
||
| ### Option 2: From local files | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Useful for when testing local changes |
||
| Run this from the parent directory of this repo. Project will be built here. | ||
| ```bash | ||
| # Build cookiecutter container to make sure it's up to date | ||
| docker build cookiecutter-django-app -t cookiecutter:latest | ||
|
|
||
| # Generate a new project | ||
| docker run --rm -it \ | ||
| --mount type=bind,source=$(pwd),target=/cookiecutter \ | ||
| cookiecutter cookiecutter-django-app | ||
| ``` | ||
|
|
||
| ### Notes | ||
| In order to make sure tests pass easily on your new repo so you can publish to Heroku, make sure to: | ||
| - add all of the cookiecutter output as one initial commit to `main` | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,6 +51,7 @@ | |
| "django.contrib.sessions", | ||
| "django.contrib.messages", | ||
| "django.contrib.staticfiles", | ||
| "django.contrib.postgres", | ||
| {% if cookiecutter.install_wagtail %}"wagtail.contrib.forms", | ||
| "wagtail.contrib.redirects", | ||
| "wagtail.contrib.simple_translation", | ||
|
|
@@ -116,6 +117,7 @@ | |
|
|
||
| DATABASES = {} | ||
|
|
||
| {% if cookiecutter.install_postgis %} | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Making sure that postgis is only used when asked for |
||
| DATABASES["default"] = dj_database_url.parse( | ||
| os.getenv( | ||
| "DATABASE_URL", "postgis://postgres:postgres@postgres:5432/{{ cookiecutter.module_name }}" | ||
|
|
@@ -124,6 +126,16 @@ | |
| ssl_require=True if os.getenv("POSTGRES_REQUIRE_SSL") else False, | ||
| engine="django.contrib.gis.db.backends.postgis", | ||
| ) | ||
| {% else %} | ||
| DATABASES["default"] = dj_database_url.parse( | ||
| os.getenv( | ||
| "DATABASE_URL", "postgres://postgres:postgres@postgres:5432/{{ cookiecutter.module_name }}" | ||
| ), | ||
| conn_max_age=600, | ||
| ssl_require=True if os.getenv("POSTGRES_REQUIRE_SSL") else False, | ||
| engine="django.db.backends.postgresql", | ||
| ) | ||
| {% endif %} | ||
|
|
||
| # Caching | ||
| # https://docs.djangoproject.com/en/stable/topics/cache/ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,7 +53,7 @@ services: | |
| POSTGRES_PASSWORD: postgres | ||
| POSTGRES_DB: {{ cookiecutter.module_name }} | ||
| volumes: | ||
| - {{ cookiecutter.module_name }}-db-data:/var/lib/postgresql/data | ||
| - {{ cookiecutter.module_name }}-db-data:/var/lib/postgresql | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got the following error from postgres 18 before this change:
So I've adjusted the location of the volumes as per this suggestion to get things working. |
||
| ports: | ||
| - 32001:5432 | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ | |
|
|
||
| class Migration(migrations.Migration): | ||
| dependencies = [ | ||
| ("wagtailcore", "0040_page_draft_title"), | ||
| ("wagtailcore", "0095_groupsitepermission"), | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Errored out when first running migrations due to a relation that didn't exist until this wagtail migration ran. So just setting that as the first dependency for our migrations. |
||
| ] | ||
|
|
||
| operations = [ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,6 @@ | |
| class Migration(migrations.Migration): | ||
| dependencies = [ | ||
| ("{{ cookiecutter.module_name }}", "0001_initial"), | ||
| ("wagtailcore", "0094_alter_page_locale"), | ||
| ] | ||
|
|
||
| operations = [ | ||
|
|
@@ -17,7 +16,7 @@ class Migration(migrations.Migration): | |
| fields=[ | ||
| ( | ||
| "id", | ||
| models.AutoField( | ||
| models.BigAutoField( | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After building the project, there was an immediate warning that a new migration needed to be made, that was just this change. |
||
| auto_created=True, | ||
| primary_key=True, | ||
| serialize=False, | ||
|
|
||
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.
Node wasn't getting successfully installed due to this missing shared dependency, so we're explicitly installing it here and confirming that node is present during the container build.