Commit Graph

143 Commits

Author SHA1 Message Date
Yuchen Xie
0374f11d09 Using WhiteNoise in development 2019-11-07 21:03:33 +08:00
Yuchen Xie
400fcc4030 Prevent collectfast from guessing a wrong strategy
If `COLLECTFAST_STRATEGY` is not provided in `settings`, `collectfast` has to guess a "strategy". For the case with AWS, it guesses `BotoStrategy` in stead of `S3Boto3Storage`, which is a wrong decision as we `pip install django-storages[boto3]` (`boto3` in favor of `boto`).

Setting `COLLECTFAST_STRATEGY` is also encouraged as `collectfast` is not going to guess the strategy in the future.

Ref:
* f37dd1faa2/collectfast/management/commands/collectstatic.py (L33)
* f37dd1faa2/collectfast/strategies/base.py (L170)
2019-10-22 10:42:32 +08:00
Caio Ariede
ff8a9de24e Updates 2019-10-04 09:32:25 -03:00
Caio Ariede
39e745dddf Fix #2250 -- No staticfile storage with GCP without Whitenoise 2019-10-02 10:10:32 -03:00
Dani Hodovic
d4d8f1b5be
Remove AWS_PRELOAD_METADATA
https://github.com/antonagestam/collectfast/pull/140
2019-08-25 14:08:28 +02:00
Dani Hodovic
a25c406975
Remove gunicorn from installed apps
I can't find the requirement of adding it to INSTALLED_APPS on the
Django or the Gunicorn docs.

https://docs.gunicorn.org/en/latest/run.html?highlight=django#django
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/gunicorn/
2019-07-09 09:00:31 +08:00
Bruno Alla
7e47e9c2aa
Mailgun api url (#2014)
Mailgun api url
2019-05-28 11:27:54 +01:00
Tano Abeleyra
9a3a796a89 Use GCP acronym for Google Cloud Platform 2019-05-27 17:39:45 -03:00
Bruno Alla
b56071f516 Fix comments and empty lines in prod settings 2019-05-27 16:33:07 +01:00
Bruno Alla
881a6fd681 Change GCP settings to f-strings 2019-05-27 15:58:56 +01:00
Bruno Alla
b4cea81f26 Fix some comment and empty lines in settings 2019-05-27 15:55:41 +01:00
Bruno Alla
92e4bdf171
Make cloud_provider optional (#2067)
Make cloud_provider optional
2019-05-27 15:50:18 +01:00
Demetris Stavrou
a636d454f6
Update {{cookiecutter.project_slug}}/config/settings/production.py
Co-Authored-By: Bruno Alla <browniebroke@users.noreply.github.com>
2019-05-22 09:46:20 +03:00
Demetris Stavrou
38b2c2dfcd Errors are now sent to Sentry 2019-05-21 22:04:03 +03:00
Tano Abeleyra
de7be3652a Make cloud_provider optional
Some projects may not need AWS or GCS
2019-05-19 12:45:28 -03:00
shireenrao
8c69a1203f
Update {{cookiecutter.project_slug}}/config/settings/production.py
Co-Authored-By: Bruno Alla <browniebroke@users.noreply.github.com>
2019-05-19 08:27:28 -04:00
shireenrao
adcc5d0b28
Update {{cookiecutter.project_slug}}/config/settings/production.py
Co-Authored-By: Bruno Alla <browniebroke@users.noreply.github.com>
2019-05-19 08:27:14 -04:00
shireenrao
570930ef13
If using whitenoise disable AWS and GCE for static
If using whitenoise disable AWS and GCE for static setting.
2019-05-18 22:49:10 -04:00
Bruno Alla
d90406c3c3 Make the static storage use public ACL 2019-05-18 14:06:05 +01:00
Bruno Alla
0fef828375 Create a logging config in base settings & add a root logger to existing ones 2019-05-15 17:20:14 +01:00
Craig Margieson
5ab5285e5f Edit STATIC and MEDIA urls for GCE production. 2019-05-06 15:13:01 +09:30
anuj
2b141e6464 Add support for GCE static 2019-04-07 00:54:46 +05:30
anuj
b5e030b784 Corrected quotes, added parameter in tests 2019-04-07 00:34:22 +05:30
anuj
cad0b77658 Added support for GCE Media storage 2019-04-05 12:42:39 +05:30
Bruno Alla
81851ffb6d Merge branch 'master' into mailgun_api_url 2019-04-02 15:45:37 +01:00
Jelmert
d1bf4f4815 Added AWS_S3_REGION_NAME to production settings 2019-04-02 15:43:48 +02:00
Jelmert
17e7d603cf Added the MAILGUN_API_URL variable to the ANYMAIL configuration so we can easily switch to the EU region for mailgun 2019-04-02 15:08:51 +02:00
Bruno Alla
4e70a4b55a
Test all possible template combinations (#1993)
## Description

Fixes #591.

## Rationale

We are currently not testing many combinations, we run Flake8 on the generated project with default options, but that rarely catch any issues.

## Use case(s) / visualization(s)

Catch problems with invalid combinations, for instance, it fails due to Whitenoise breaking flake8 with `django-compressor` because `STATIC_URL` was undefined here:

b91c70d755/%7B%7Bcookiecutter.project_slug%7D%7D/config/settings/production.py (L185)
2019-04-01 08:47:46 +01:00
Guilherme Fabrizio
7d1e90bdf5 Migrate to unified Sentry SDK (#1820)
The raven library is deprecated. Replace it by the new sentry-sdk library:

https://docs.sentry.io/error-reporting/quickstart/?platform=python

fixes #1818
2019-03-20 10:04:44 +00:00
Bruno Alla
6e9f87fced Set AWS_DEFAULT_ACL to None as per django-storages documentation
fixes #1885
2019-03-19 19:57:31 +00:00
Bruno Alla
68f7268770
Run Black on Travis (#1957)
* Create a test matrix on Travis CI to help testing multiple options

* Change test_docker.sh to fail if any command in it fails

* Run black on the CI with --check option

* Fix formatting of project files using black

* Install black in the docker container

* Exclude migrations in black checks

* Fix Black formatting violations

* Run black on the whole generated project & fix issues
2019-03-18 17:49:43 +00:00
Carl Johnson
1753812136 Settings: Use security settings in dev as well as prod 2018-11-12 15:04:03 -05:00
Chris Pappalardo
ea53635a0a fixed production bugs in caddyfile and middleware 2018-09-15 12:45:10 -07:00
Umair Ashraf
bf6c7e8e9c fixed s3 http url for static and media storage 2018-09-12 13:45:30 -04:00
Wan Liuyang
de5504f414
Rename custom S3Boto3Storage subclasses (#1784)
Closes #1788 

This PR preps for the upcoming `django-storages` 2.X:

1. ~~Explicitly set default ACL to None which was [incorrectly set](3f6ec74942/storages/backends/s3boto3.py (L195)) to `public-read` by `django-storages`~~

2. Renamed `StaticRootS3BotoStorage` to `StaticRootS3Boto3Storage` to avoid confusion. This is to prep for the upcoming `S3Boto` class deprecation.

See also:
https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html#settings
https://github.com/jschneier/django-storages/blob/master/CHANGELOG.rst
2018-09-09 19:59:04 +08:00
Irfan
27ae9c36e4 Fix #1771: Use full-fledge S3 Storage class in production settings
sorl-thumbnail serialized and deserializes the storage class and during this
process location parameter is lost if factory is used. Using a full-fledge
storage class fixes this issue.

See: https://stackoverflow.com/a/18046120/104731
2018-09-01 11:49:01 +05:00
Nikita P. Shupeyko
ac61117b59 Prevent AWS S3 bucket from being created automatically
Rationale: most of the time you want to create a bucket yourself in order to assign/tweak polices etc.
2018-06-28 16:35:35 +03:00
Nikita Shupeyko
fe3f45ba7d
Rename DJANGO_SENTRY_DSN env to SENTRY_DSN (#1663)
Rationale: so that Heroku auto-provisioned Sentry addon, with its SENTRY_DSN config var is being connected to out-of-box
2018-05-27 22:36:13 +03:00
Nikita P. Shupeyko
b069f8e40e Fix E303 in production.py 2018-05-21 21:57:52 +03:00
Nikita P. Shupeyko
600be33b85 Fix E402 in production.py 2018-05-21 21:57:31 +03:00
Nikita P. Shupeyko
fd15b20a08 Use string interpolation in production STATIC_URL 2018-05-13 17:03:04 +03:00
Nikita P. Shupeyko
661fc3e449 Fix E402 2018-05-09 13:42:20 +03:00
Nikita P. Shupeyko
a07327459c Fix logging module imported unconditionally in production.py 2018-05-09 13:24:08 +03:00
Nikita P. Shupeyko
00ff5c8506
Fix a typo in production.py 2018-05-07 20:33:34 +03:00
Osaetin Daniel
a4f059196e Removed unnecessary sentry configuration (#1598) 2018-04-10 10:39:44 +08:00
Nikita P. Shupeyko
26ccf9307f Fix REDIS_URL missing
Fixes #1570.
2018-04-04 13:42:01 +03:00
Nikita P. Shupeyko
418b53bf77 Rename use_sentry_for_error_reporting to use_sentry
Rationale: consistency
2018-04-03 12:12:26 +03:00
Wan Liuyang
d1198f63b1
Drop Opbeat (#1578) 2018-03-21 19:54:27 +08:00
Wan Liuyang
9cb7e50b8e Convert old-styled string formatting to f-string (#1528)
* Convert old-styled string formatting to f-string

* Update flake8 explicit version to 3.5.0

* Make tox.ini in sync with requirements.txt

* Fix annoying flake8 F405
2018-03-06 19:56:27 +03:00
Nikita Shupeyko
d2791b019a
Prettify and re-order settings entries (#1550)
* Prettify and re-order settings entries

* Use old-style .format() for the time being

* Remove redundant linebreaks at the settings files' beginning

* Fix E303 too many blank lines

* Remove a redundant linebreak from requirements.txt

* Some linebreake juggling in config.settings.base
2018-03-06 14:28:25 +03:00
Bruno Alla
82dcd2d30c Simplify Mailgun settings
When creating a Mailgun add-on on Heroku, the app gets some environment
variables by default:

    MAILGUN_API_KEY
    MAILGUN_DOMAIN

However, the cookiecutter names do not match and requires a manual step
from the user deploying. It's used elsewhere but shouldn't harm the
other deployment methods to rename these variables.

While updating the docs I noticed a variable that appear unused
DJANGO_MAILGUN_SERVER_NAME so this removes it from the documentation.
2018-03-05 17:56:45 +00:00
Nikita P. Shupeyko
f4e217ed21 Simplify production databases section generation 2018-03-04 17:33:54 +03:00
Wan Liuyang
30dfbbd0ab Remove AWS S3 header bytes workaround 2018-02-20 16:04:16 +08:00
Bruno Alla
3853094221
Merge pull request #1374 from svleeuwen/patch-1
Remove boto related settings that aren't used
2018-02-16 21:19:35 +00:00
Hashim Muqtadir
e8ca2dd8ea Add atomic requests setting to production.py (#1513)
Since config/production.py sets a new value for `DATABASES['default']`, the `DATABASES['default']['ATOMIC_REQUESTS'] = True` setting from base gets overridden. So it's probably a good idea to add it back.
2018-02-16 18:15:50 +03:00
Sander van Leeuwen
bef1bb856e
Add cache control via AWS_S3_OBJECT_PARAMETERS setting
Previously covered by AWS_HEADERS
2018-02-13 16:04:43 +01:00
Daniel Roy Greenfeld
793a46ba45 Removed expiramental elastic beanstalk support and bumped official Django version to 1.11.9 2018-01-15 12:33:51 -08:00
Pierre Chiquet
d2dd265a99 Fix MediaRootS3BotoStorage: do not override existing files (#1367)
* Fix MediaRootS3BotoStorage: do not override existing files

see https://github.com/jschneier/django-storages/issues/50

* Update "other contributors"

* alphabetical order
2017-12-13 16:06:48 +03:00
Bruno Alla
4f8cd89bb7 Set CONN_MAX_AGE to 60 seconds -- fixes #710 (#1382)
* Set CONN_MAX_AGE to 60 seconds -- fixes #710

Setting the value in the production config.

* Get CONN_MAX_AGE from the environment, default to 60 in .env

* Add test for CONN_MAX_AGE setting

* Remove duplication in default value & test cleanup

* Remove test for CONN_MAX_AGE value in settings
2017-11-13 23:08:47 +03:00
Sander van Leeuwen
9661ecaf8f Remove boto related settings that aren't used
Since upgrade to boto3 in commit 12db5176d6 we don't need AWS_HEADERS anymore
2017-10-25 14:11:36 +02:00
Chris Franklin
d0e5c4b3b6 Fix comments and silence PEP8 lambda warnings in config module. (#1357) 2017-10-12 20:36:44 +03:00
Wan Liuyang
ea5fb0efb6 Update EMAIL_BACKEND to "anymail.backends.espname.EmailBackend" to match anymail 1.0 (#1335) 2017-09-18 16:19:09 +03:00
Reggie Riser
0e1c00d3b3 Fixed typo in generated comment. (#1306) 2017-08-28 22:30:56 +03:00
Bruno Alla
4be48b7999 Use django-storages for media files if using WhiteNoise - fixes #1192
As per the discussion in #869, WhiteNoise is for serving static files
not for media files (files uploaded from the app by users).
For such thing, we still need `DEFAULT_FILE_STORAGE` to be set and
we use django-storages for that.
2017-08-02 20:10:49 +01:00
Bruno Alla
12db5176d6 Upgrade to boto3 fixes #998
- Boto3 is the replacement of boto, switch to the latest version
- Switch django-storages class to the one based on Boto3
- AWS_S3_CALLING_FORMAT isn't relevant anymore
2017-08-02 20:00:03 +01:00
Daniel Roy Greenfeld
6aced9ba73 Remove Python 2.7 support per #1129 (#1130)
* Remove Python 2.7 support per

* Remove Python 2.7 references

* Remove Python 2.7 references

* remove python 2 entirely
2017-04-21 12:31:45 -07:00
Reggie Riser
2006605e24 A few cleanups: 1) Fixed common.py references (now called base.py), 2) Made URLs consistent in pointing to dev Django docs as well as https, (#1037) 2017-02-21 11:55:51 -08:00
Jimmy Gitonga
f4ef73efbf ADDED: HTTPS is on by default (#1025)
ADDED: HTTPS is on by default. This will give a new user an
understanding of why Cookie Django is set up securely for deployment in
a production environment.
2017-02-13 12:27:09 -08:00
Daniel Roy Greenfeld
9a837171b6 Merge branch 'make-settings-consistent-w-req' of https://github.com/statwonk/cookiecutter-django into statwonk-make-settings-consistent-w-req 2017-02-13 10:48:10 -08:00
schacki
65611f14ea Updated settings to only include lists and ' (#930)
* Updated settings to only include lists and '

Substituted " with ' in files
Migrated tuples  to lists

* Added trailing slashes

- trailing slashes
- minor cleanups
2017-02-13 10:33:52 -08:00
statwonk
62d86877e4 Missed a few references to the renamed settings file. This brings them inline. 2017-01-16 21:38:52 -06:00
Tim Freund
59948514ab Update doc links from getsentry.com to sentry.io (#917)
Sentry changed their name and URLs:
https://blog.sentry.io/2016/08/30/sentry-io.html Links in the
cookiecutter-django project are updated to reflect the new locations.
2016-11-30 14:32:38 -08:00
Fabio C. Barrioneuvo da Luz
f2aab6edc3 rename MIDDLEWARE_CLASSES to MIDDLEWARE 2016-09-29 01:43:48 -03:00
Daniel Roy Greenfeld
a091dcbae8 Fix elastic beanstalk checks 2016-09-29 01:43:48 -03:00
Daniel Roy Greenfeld
cac685d909 Add Experimental AWS Elastic Beanstalk support (#817)
Includes:

* First pass at Elastic Beanstalk integration
* Gets code and elasticache working
* Very rudimentary documentation
* Includes post hook cleanup
2016-09-29 01:43:48 -03:00
Delio Castillo
3d25befb3f Updates to anymail 0.5 and adds new config setting for MAILGUN_SENDER_DOMAIN 2016-09-22 11:42:16 -07:00
Jannis Gebauer
7d7b044432 Remove webpack and merge (#778) (#785)
* Remove webpack and merge

* Put postgresql_version line back in cookiecutter.json

* Put goldhand back in contributors file, added ssteinerX

* Add *.egginfo to .gitignore

* Fix dangling endif in README.rst
2016-09-12 00:22:21 +02:00
Jannis Gebauer
0f527271a3 Merge pull request #766 from aleprovencio/separator-line
Put separator line following the current pattern
2016-09-02 09:49:16 +02:00
Alexandre Provencio
b33b104251 Put separator line following the current pattern 2016-08-31 12:56:25 -03:00
Alexandre Provencio
3ad2d5c61e Fix docstrings 2016-08-31 12:48:25 -03:00
Will Farley
8880e777d2 WIP: Add webpack as an option (#610)
* Add webpack as an option

Adds webpack as a js_taskrunner option to cookiecutter-json. Will clone @hzdg/cookiecutter-webpack --pydanny-django branch into the project using cookiecutter's api in post_hooks.

The static webpack project will be placed into the <project_slug>/static/<project_slug>/ directory.
The webpack configs are placed in the ./config/ directory.

The cookiecutter-webpack project includes react / redux / karma configurations that are brought into the project.

* Add webpack documentation
2016-06-19 12:24:43 -07:00
Andres Gonzalez
3d2385a3b6 Add django-compressor suport (#568)
* #342 Add compressor option to requirements

* #342 Add compressor to production settings

* #342 Add compressor to base template

* #342 Add settings to common.py and add tags to base template

* #342 Flake8 fix for tox tests

* #342 Remove redundant line

* #342 Add required options for S3 to production.py and added Env variable to enable/disable compression

* #342 Add required options for compressor on S3 to production.py
2016-06-17 19:07:45 -07:00
Daniel Roy Greenfeld
fd2e7dd0fe Whitespace fix 2016-06-05 11:04:48 -07:00
Daniel Roy Greenfeld
f40f304457 Use sentry for error reporting 2016-06-05 10:47:07 -07:00
Leonardo
907b8ecfbd Remove django-secure (#579)
* Eliminate django-secure from requirements and settings files

* Include secure defaults for django security middleware

* Add settings required by SecurityMiddleware

also remove django-secure in prod settings

* Eliminate empty spaces generated on Jinja on
config/settings/production.py
2016-06-03 16:07:27 -07:00
Daniel Roy Greenfeld
05c521dd61 remove errant line 2016-05-29 14:53:26 -07:00
Daniel Roy Greenfeld
e84f0a488d PEP8 fix 2016-05-29 10:08:39 -07:00
Audrey Roy Greenfeld
a658339b99 Switch from django-mailgun to django-anymail. Fix #539. 2016-05-27 11:31:30 -07:00
Daniel Roy Greenfeld
c7c1d0bfa1 Remove Raven 404 catch middleware. Fix #367 2016-05-11 21:53:30 -07:00
Fabio C. Barrioneuvo da Luz
2b878fcf36 replace occurrences of readthedocs.org to readthedocs.io 2016-05-09 17:18:58 -03:00
Trung Dong Huynh
3c6898b3f6 Updated whitenoise configuration to match changes in version 3.0
(see http://whitenoise.evans.io/en/stable/changelog.html)
2016-05-08 11:55:32 +01:00
Daniel Roy Greenfeld
7a5712c379 Check to confirm that the user has a modern version of Cookiecutter. 2016-04-25 14:10:39 -07:00
Audrey Roy Greenfeld
15f350f05e Change repo_name to project_slug for clarity. 2016-04-20 10:00:35 -07:00