Steps to reproduce:
Using the docker CE in windows, version Version 17.03.1-ce-win12
Static fields are not served, collectstatic is working and copies files to the destination dir
however only templates are served.
@chopanpma, did you opt out for Let's Encrypt?
Yes, use_letsencript=n
On Jun 21, 2017 12:50 PM, "Shupeyko Nikita" notifications@github.com
wrote:
@chopanpma https://github.com/chopanpma, did you opted out for Let's
Encrypt?—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/pydanny/cookiecutter-django/issues/1204#issuecomment-310155551,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ALRjVY3tmjcnf8gzSFpBK3sdGBzdYi9Kks5sGVfegaJpZM4OBPS1
.
@chopanpma, have you tested it with the recent EAP PyCharm release where they added support for Docker Compose on Windows? (I know this is most likely not the case, but still.)
@chopanpma, the issue occurs since we don't have Node.JS running in production mode as of now -- this is the shortcoming of the PR (#1128) I've been working on and finally merged it yesterday.
@chopanpma I will fix this ASAP.
@chopanpma I've rolled the #1128 back -- re-iterate, please, to make sure it works for you.
Thanks @webyneter, Ill test right know and let you know.
On Jun 21, 2017 3:20 PM, "Shupeyko Nikita" notifications@github.com wrote:
@chopanpma https://github.com/chopanpma I've rolled the #1128
https://github.com/pydanny/cookiecutter-django/pull/1128 back --
re-iterate, please, to make sure it works for you.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/pydanny/cookiecutter-django/issues/1204#issuecomment-310193360,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ALRjVeLbMtkgIiPIf3txj1Gj_drUehPeks5sGXr0gaJpZM4OBPS1
.
@chopanpma, I hope it went well?..
Still working on it,
don't use AWS for static storage, and had to enable COLLECTSTATIC= True
Still testing.
On Wed, Jun 21, 2017 at 3:44 PM, Shupeyko Nikita notifications@github.com
wrote:
@chopanpma https://github.com/chopanpma hope it went well?..
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/pydanny/cookiecutter-django/issues/1204#issuecomment-310199537,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ALRjVQgYjgof4Uiybe6DSHvcB6jBPv5nks5sGYCxgaJpZM4OBPS1
.
--
Eng. Francisco Castañeda
Manager
Montuoso Software Engineering Inc.
e-mail:[email protected]
www.montuoso.com
"""
Production Configurations
"""
from boto.s3.connection import OrdinaryCallingFormat
from .base import * # noqa
SECRET_KEY = env('DJANGO_SECRET_KEY')
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
SECURE_HSTS_SECONDS = 60
SECURE_HSTS_INCLUDE_SUBDOMAINS = env.bool(
'DJANGO_SECURE_HSTS_INCLUDE_SUBDOMAINS', default=True)
SECURE_CONTENT_TYPE_NOSNIFF = env.bool(
'DJANGO_SECURE_CONTENT_TYPE_NOSNIFF', default=True)
SECURE_BROWSER_XSS_FILTER = True
SESSION_COOKIE_SECURE = True
SESSION_COOKIE_HTTPONLY = True
SECURE_SSL_REDIRECT = env.bool('DJANGO_SECURE_SSL_REDIRECT', default=True)
CSRF_COOKIE_SECURE = True
CSRF_COOKIE_HTTPONLY = True
X_FRAME_OPTIONS = 'DENY'
ALLOWED_HOSTS = ['*', ]
INSTALLED_APPS += ['gunicorn', ]
#
#
#
AWS_EXPIRY)
#
#
#
#
#
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage'
INSTALLED_APPS = ['collectfast', ] + INSTALLED_APPS
COLLECTFAST_ENABLED = True
DEFAULT_FROM_EMAIL = env('DJANGO_DEFAULT_FROM_EMAIL',
default='test_production2
EMAIL_SUBJECT_PREFIX = env('DJANGO_EMAIL_SUBJECT_PREFIX',
default='[test_production2]')
SERVER_EMAIL = env('DJANGO_SERVER_EMAIL', default=DEFAULT_FROM_EMAIL)
INSTALLED_APPS += ['anymail', ]
ANYMAIL = {
'MAILGUN_API_KEY': env('DJANGO_MAILGUN_API_KEY'),
'MAILGUN_SENDER_DOMAIN': env('MAILGUN_SENDER_DOMAIN')
}
EMAIL_BACKEND = 'anymail.backends.mailgun.MailgunBackend'
TEMPLATES[0]['OPTIONS']['loaders'] = [
('django.template.loaders.cached.Loader', [
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader', ]),
]
DATABASES['default'] = env.db('DATABASE_URL')
REDIS_LOCATION = '{0}/{1}'.format(env('REDIS_URL',
default='redis://127.0.0.1:6379'), 0)
CACHES = {
'default': {
'BACKEND': 'django_redis.cache.RedisCache',
'LOCATION': REDIS_LOCATION,
'OPTIONS': {
'CLIENT_CLASS': 'django_redis.client.DefaultClient',
'IGNORE_EXCEPTIONS': True, # mimics memcache behavior.
#
http://niwinz.github.io/django-redis/latest/#_memcached_exceptions_behavior
}
}
}
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'formatters': {
'verbose': {
'format': '%(levelname)s %(asctime)s %(module)s '
'%(process)d %(thread)d %(message)s'
},
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false', ],
'class': 'django.utils.log.AdminEmailHandler'
},
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'verbose',
},
},
'loggers': {
'django.request': {
'handlers': ['mail_admins', ],
'level': 'ERROR',
'propagate': True
},
'django.security.DisallowedHost': {
'level': 'ERROR',
'handlers': ['console', 'mail_admins', ],
'propagate': True
}
}
}
ADMIN_URL = env('DJANGO_ADMIN_URL')
settings# ------------------------------------------------------------------------------
This is my production.py
I had to comment out amazon settings,
but I am having problems starting django up with docker-compose up
django_1 | Copying
'/usr/local/lib/python3.5/site-packages/django/contrib/admin/static/admin/js/vendor/xregexp/xregexp.min.js'
django_1 | Ignored error in Collectfast:
django_1 | 'StaticFilesStorage' object has no attribute
'_normalize_name'
django_1 | --> Continuing using default collectstatic.
django_1 | Copying
'/usr/local/lib/python3.5/site-packages/django/contrib/admin/static/admin/js/vendor/xregexp/xregexp.js'
django_1 | Ignored error in Collectfast:
django_1 | 'StaticFilesStorage' object has no attribute
'_normalize_name'
On Wed, Jun 21, 2017 at 3:46 PM, Francisco Castañeda <
[email protected]> wrote:
Still working on it,
don't use AWS for static storage, and had to enable COLLECTSTATIC= TrueStill testing.
On Wed, Jun 21, 2017 at 3:44 PM, Shupeyko Nikita <[email protected]
wrote:
@chopanpma https://github.com/chopanpma hope it went well?..
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/pydanny/cookiecutter-django/issues/1204#issuecomment-310199537,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ALRjVQgYjgof4Uiybe6DSHvcB6jBPv5nks5sGYCxgaJpZM4OBPS1
.--
Eng. Francisco Castañeda
Manager
Montuoso Software Engineering Inc.
e-mail:[email protected]
www.montuoso.com
--
Eng. Francisco Castañeda
Manager
Montuoso Software Engineering Inc.
e-mail:[email protected]
www.montuoso.com
@chopanpma, is it safe to say that this particular issue is no longer the case? (Then, we could switch to that new one.)
It worked Thanks a a lot,
just had to change COLLECTFAST_ENABLED = False
On Wed, Jun 21, 2017 at 3:49 PM, Francisco Castañeda <
[email protected]> wrote:
"""
Production Configurations
- Use Amazon's S3 for storing static files and uploaded media
- Use mailgun to send emails
- Use Redis for cache
"""
from boto.s3.connection import OrdinaryCallingFormat
from .base import * # noqa
SECRET CONFIGURATION
------------------------------------------------------------------------------
See: https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
Raises ImproperlyConfigured exception if DJANGO_SECRET_KEY not in os.environ
SECRET_KEY = env('DJANGO_SECRET_KEY')
This ensures that Django will be able to detect a secure connection
properly on Heroku.
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
SECURITY CONFIGURATION
------------------------------------------------------------------------------
See https://docs.djangoproject.com/en/dev/ref/middleware/#module-django.middleware.security
and https://docs.djangoproject.com/en/dev/howto/deployment/checklist/#run-manage-py-check-deploy
set this to 60 seconds and then to 518400 when you can prove it works
SECURE_HSTS_SECONDS = 60
SECURE_HSTS_INCLUDE_SUBDOMAINS = env.bool(
'DJANGO_SECURE_HSTS_INCLUDE_SUBDOMAINS', default=True)
SECURE_CONTENT_TYPE_NOSNIFF = env.bool(
'DJANGO_SECURE_CONTENT_TYPE_NOSNIFF', default=True)
SECURE_BROWSER_XSS_FILTER = True
SESSION_COOKIE_SECURE = True
SESSION_COOKIE_HTTPONLY = True
SECURE_SSL_REDIRECT = env.bool('DJANGO_SECURE_SSL_REDIRECT', default=True)
CSRF_COOKIE_SECURE = True
CSRF_COOKIE_HTTPONLY = True
X_FRAME_OPTIONS = 'DENY'SITE CONFIGURATION
------------------------------------------------------------------------------
Hosts/domain names that are valid for this site
See https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
ALLOWED_HOSTS = ['*', ]
END SITE CONFIGURATION
INSTALLED_APPS += ['gunicorn', ]
STORAGE CONFIGURATION
# ------------------------------------------------------------------------------
# Uploaded Media Files
# ------------------------
# See: http://django-storages.readthedocs.io/en/latest/index.html
INSTALLED_APPS += ['storages', ]
#
AWS_ACCESS_KEY_ID = env('DJANGO_AWS_ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY = env('DJANGO_AWS_SECRET_ACCESS_KEY')
AWS_STORAGE_BUCKET_NAME = env('DJANGO_AWS_STORAGE_BUCKET_NAME')
AWS_AUTO_CREATE_BUCKET = True
AWS_QUERYSTRING_AUTH = False
AWS_S3_CALLING_FORMAT = OrdinaryCallingFormat()
#
# AWS cache settings, don't change unless you know what you're doing:
AWS_EXPIRY = 60 * 60 * 24 * 7
#
# TODO See: https://github.com/jschneier/django-storages/issues/47
# Revert the following and use str after the above-mentioned bug is fixed in
# either django-storage-redux or boto
control = 'max-age=%d, s-maxage=%d, must-revalidate' % (AWS_EXPIRY, AWS_EXPIRY)
AWS_HEADERS = {
'Cache-Control': bytes(control, encoding='latin-1')
}
#
# URL that handles the media served from MEDIA_ROOT, used for managing
# stored files.
#
# See:http://stackoverflow.com/questions/10390244/
from storages.backends.s3boto import S3BotoStorage
StaticRootS3BotoStorage = lambda: S3BotoStorage(location='static')
MediaRootS3BotoStorage = lambda: S3BotoStorage(location='media')
DEFAULT_FILE_STORAGE = 'config.settings.production.MediaRootS3BotoStorage'
#
MEDIA_URL = 'https://s3.amazonaws.com/%s/media/' % AWS_STORAGE_BUCKET_NAME
#
# Static Assets
# ------------------------
#
STATIC_URL = 'https://s3.amazonaws.com/%s/static/' % AWS_STORAGE_BUCKET_NAME
STATICFILES_STORAGE = 'config.settings.production.StaticRootS3BotoStorage'
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage'
# See: https://github.com/antonagestam/collectfast
# For Django 1.7+, 'collectfast' should come before
# 'django.contrib.staticfiles'
AWS_PRELOAD_METADATA = True
INSTALLED_APPS = ['collectfast', ] + INSTALLED_APPS
COLLECTFAST_ENABLED = True------------------------------------------------------------------------------
DEFAULT_FROM_EMAIL = env('DJANGO_DEFAULT_FROM_EMAIL',
default='test_production2')
EMAIL_SUBJECT_PREFIX = env('DJANGO_EMAIL_SUBJECT_PREFIX', default='[test_production2]')
SERVER_EMAIL = env('DJANGO_SERVER_EMAIL', default=DEFAULT_FROM_EMAIL)Anymail with Mailgun
INSTALLED_APPS += ['anymail', ]
ANYMAIL = {
'MAILGUN_API_KEY': env('DJANGO_MAILGUN_API_KEY'),
'MAILGUN_SENDER_DOMAIN': env('MAILGUN_SENDER_DOMAIN')
}
EMAIL_BACKEND = 'anymail.backends.mailgun.MailgunBackend'TEMPLATE CONFIGURATION
------------------------------------------------------------------------------
See:
https://docs.djangoproject.com/en/dev/ref/templates/api/#django.template.loaders.cached.Loader
TEMPLATES[0]['OPTIONS']['loaders'] = [
('django.template.loaders.cached.Loader', [
'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', ]),
]DATABASE CONFIGURATION
------------------------------------------------------------------------------
Use the Heroku-style specification
Raises ImproperlyConfigured exception if DATABASE_URL not in os.environ
DATABASES['default'] = env.db('DATABASE_URL')
CACHING
------------------------------------------------------------------------------
REDIS_LOCATION = '{0}/{1}'.format(env('REDIS_URL', default='redis://127.0.0.1:6379'), 0)
Heroku URL does not pass the DB number, so we parse it in
CACHES = {
'default': {
'BACKEND': 'django_redis.cache.RedisCache',
'LOCATION': REDIS_LOCATION,
'OPTIONS': {
'CLIENT_CLASS': 'django_redis.client.DefaultClient',
'IGNORE_EXCEPTIONS': True, # mimics memcache behavior.
# http://niwinz.github.io/django-redis/latest/#_memcached_exceptions_behavior
}
}
}LOGGING CONFIGURATION
------------------------------------------------------------------------------
See: https://docs.djangoproject.com/en/dev/ref/settings/#logging
A sample logging configuration. The only tangible logging
performed by this configuration is to send an email to
the site admins on every HTTP 500 error when DEBUG=False.
See https://docs.djangoproject.com/en/dev/topics/logging for
more details on how to customize your logging configuration.
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'formatters': {
'verbose': {
'format': '%(levelname)s %(asctime)s %(module)s '
'%(process)d %(thread)d %(message)s'
},
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false', ],
'class': 'django.utils.log.AdminEmailHandler'
},
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'verbose',
},
},
'loggers': {
'django.request': {
'handlers': ['mail_admins', ],
'level': 'ERROR',
'propagate': True
},
'django.security.DisallowedHost': {
'level': 'ERROR',
'handlers': ['console', 'mail_admins', ],
'propagate': True
}
}
}Custom Admin URL, use {% url 'admin:index' %}
ADMIN_URL = env('DJANGO_ADMIN_URL')
Your production stuff: Below this line define 3rd party library settings# ------------------------------------------------------------------------------
This is my production.py
I had to comment out amazon settings,
but I am having problems starting django up with docker-compose updjango_1 | Copying '/usr/local/lib/python3.5/
site-packages/django/contrib/admin/static/admin/js/vendor/
xregexp/xregexp.min.js'
django_1 | Ignored error in Collectfast:
django_1 | 'StaticFilesStorage' object has no attribute
'_normalize_name'
django_1 | --> Continuing using default collectstatic.
django_1 | Copying '/usr/local/lib/python3.5/
site-packages/django/contrib/admin/static/admin/js/vendor/
xregexp/xregexp.js'
django_1 | Ignored error in Collectfast:
django_1 | 'StaticFilesStorage' object has no attribute
'_normalize_name'On Wed, Jun 21, 2017 at 3:46 PM, Francisco Castañeda <
[email protected]> wrote:Still working on it,
don't use AWS for static storage, and had to enable COLLECTSTATIC= TrueStill testing.
On Wed, Jun 21, 2017 at 3:44 PM, Shupeyko Nikita <
[email protected]> wrote:@chopanpma https://github.com/chopanpma hope it went well?..
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/pydanny/cookiecutter-django/issues/1204#issuecomment-310199537,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ALRjVQgYjgof4Uiybe6DSHvcB6jBPv5nks5sGYCxgaJpZM4OBPS1
.--
Eng. Francisco Castañeda
Manager
Montuoso Software Engineering Inc.
e-mail:[email protected]
www.montuoso.com--
Eng. Francisco Castañeda
Manager
Montuoso Software Engineering Inc.
e-mail:[email protected]
www.montuoso.com
--
Eng. Francisco Castañeda
Manager
Montuoso Software Engineering Inc.
e-mail:[email protected]
www.montuoso.com
@chopanpma, so, I can close this one now, right?
Thanks a lot @webyneter, I am impressed, and the team and managers with
your help, I hope we can coolaborate with something, more than buying
books, I bought one my self, I am going to go for the new edition and I
hope some day be contributor.
On Wed, Jun 21, 2017 at 3:51 PM, Shupeyko Nikita notifications@github.com
wrote:
@chopanpma https://github.com/chopanpma, is it safe to say that this
particular issue is no longer the case? (Then, we could switch to that new
one.)—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/pydanny/cookiecutter-django/issues/1204#issuecomment-310201473,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ALRjVfs9KRvpBLY2tmfVGN8Cer7FINiJks5sGYJrgaJpZM4OBPS1
.
--
Eng. Francisco Castañeda
Manager
Montuoso Software Engineering Inc.
e-mail:[email protected]
www.montuoso.com
YESSS
On Wed, Jun 21, 2017 at 3:53 PM, Shupeyko Nikita notifications@github.com
wrote:
@chopanpma https://github.com/chopanpma, so, I can close this one now,
right?—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/pydanny/cookiecutter-django/issues/1204#issuecomment-310201909,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ALRjVfkvKXcydsl86SmN8CTgikYwHlUCks5sGYLLgaJpZM4OBPS1
.
--
Eng. Francisco Castañeda
Manager
Montuoso Software Engineering Inc.
e-mail:[email protected]
www.montuoso.com
@chopanpma, thank you, me and all the contributors very appreciate that!
Yes, Two Scoops is undoubtedly a masterpiece thanks to the amazing work by @pydanny, @audreyr and the community.
Most helpful comment
YESSS
On Wed, Jun 21, 2017 at 3:53 PM, Shupeyko Nikita notifications@github.com
wrote:
--
Eng. Francisco Castañeda
Manager
Montuoso Software Engineering Inc.
e-mail:[email protected]
www.montuoso.com