Giter Club home page Giter Club logo

aldryn-django's Introduction

Aldryn Django

pypi build coverage

An opinionated Django setup bundled as a Divio Cloud addon.

This package will auto configure Django, including admin and some other basic packages. It also handles sane configuration of the database connection and static and media files.

The goal is to keep the footprint inside the Django website project as small as possible, so updating things usually just means bumping a version in requirements.txt and no other changes in the project.

This addon still uses the legacy "Aldryn" naming. You can read more about this in our support section.

Contributing

This is a an open-source project. We'll be delighted to receive your feedback in the form of issues and pull requests. Before submitting your pull request, please review our contribution guidelines.

We're grateful to all contributors who have helped create and maintain this package. Contributors are listed at the contributors section.

Documentation

See REQUIREMENTS in the setup.py file for additional dependencies:

python django

Installation

Nothing to do. aldryn-django is part of the Divio Cloud platform.

For a manual install:

Important

Please follow the setup instructions for installing aldryn-addons first!

Add aldryn-django to your projects requirements.txt or pip install it.

The version is made up of the Django release with an added digit for the release version of this package itself.

If you followed the aldryn-addons installation instructions, you should already have a ALDRYN_ADDONS setting. Add aldryn-django to it:

INSTALLED_ADDONS = [
    'aldryn-django',
]

Create the addons/aldryn-django directory at the same level as your manage.py. Then copy addon.json, aldryn_config.py from the matching sourcecode into it.

Also create a settings.json file in the same directory with the following content:

{
    "languages": "[\"en\", \"de\"]"
}

Note

The need to manually copy aldryn_config.py and addon.json is due to legacy compatibility with the Divio Cloud platform and will no longer be necessary in a later release of aldryn-addons.

Configuration

aldryn-django comes with entrypoints for manage.py and wsgi.py. This makes it possible to just have a small snippet of code in the website project that should never change inside those files. The details of local project setup (e.g reading environment variables from a .env file) are then up to the currently installed version of aldryn-django. Also other opinionated things can be done, like using a production-grade wsgi middleware to serve static and media files.

Put this in manage.py:

#!/usr/bin/env python
import os
from aldryn_django import startup


if __name__ == "__main__":
    startup.manage(path=os.path.dirname(os.path.abspath(__file__)))

put this in wsgi.py:

import os
from aldryn_django import startup


application = startup.wsgi(path=os.path.dirname(__file__))

APIs

Migrations

To run migrations, call the command aldryn-django migrate. This will run a series of commands for the migration stage of a project.

aldryn-django will run python manage.py migrate. But any addon can add stuff to this migration step by appending commands to the MIGRATION_COMMANDS setting. For example aldryn-cms (django-cms as an Addon) will run python manage.py cms fix-tree at the migration stage.

Production Server

Calling aldryn-django web will start an opinionated Django setup for production (currently uWSGI based).

Running Tests

You can run tests by executing:

virtualenv env
source env/bin/activate
pip install -r tests/requirements.txt
python setup.py test

aldryn-django's People

Contributors

chive avatar czpython avatar evildmp avatar filwaitman avatar finalangel avatar garetjax avatar glasnt avatar jqb avatar kinkerl avatar mkoistinen avatar stefanfoulis avatar vladox avatar vthaian avatar vxsx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aldryn-django's Issues

aldryn-django 1.8.19.1 incompatible with django-storages 1.7.1

Hi,

installing aldryn-django 1.8.19.1 with pip produces the following error:

django-storages 1.7.1 has requirement Django>=1.11, but you'll have django 1.8.19 which is incompatible.

I'm willing to provide a PR to pin the dependency on django-storages in the setup.py file.

Cheers!

serve static files with uwsgi

--static-map /static=/var/www/

make it configurable, because on aldryn stage sites need to dynamically load altered static files.

Django 2.0

Adding support for Django 2.0 is a bit more complicated than just bumping the version.
MIDDLEWARE_CLASSES has been removed and replaced by a new system. All dependencies that have middlewares need to be made compatible.

  • make a support/2.0.x branch
  • figure out MIDDLEWARE_CLASSES replacement ( django docs )
    • make aldryn-addons compatible
    • aldryn-sso
    • aldryn-django-cms (does not have general 2.0 support yet)
  • ...

Not complete requirements in version 3.0.2.2

Got this error during building my project:
[0m[91m from aldryn_django.storage import parse_storage_url
File "/usr/local/lib/python3.6/site-packages/aldryn_django/storage.py", line 17, in
[0m[91m from storages.backends import s3boto
ImportError: cannot import name 's3boto'

MEDIA_ROOT is not properly set when running in development env (local)

We have just discovered a bug in aldryn_config for aldryn_django in the latests version > 3

when running locally in the line 395 dsn.path = settings['MEDIA_ROOT'], MEDIA_ROOT is always an empty string
apparently MEDIA_ROOT gets properly set just on line 426: settings['MEDIA_ROOT'] = env('MEDIA_ROOT', os.path.join(settings['DATA_ROOT'], 'media'))
The issue is that locally no media can be located due to an invalid media path

nginx config needs to forward headers from lb

the nginx config needs to forward headers from the loadbalancers that are needed by the django app:

  • http-x-forwarded-proto: needed by django to determine if the connection is http or https
  • anything else?

Opbeat archived

pip install aldryn-django doesn't work anymore on the newest python versions, since opbeat doesn't support them. Is there any alternative for this?

Current error I'm getting (because of the reserved "async" keyword):

Collecting opbeat
  Using cached opbeat-3.6.1.tar.gz (81 kB)
    ERROR: Command errored out with exit status 1:
     command: /home/arno/Documents/website/venv/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xy3kxj6b/opbeat/setup.py'"'"'; __file__='"'"'/tmp/pip-install-xy3kxj6b/opbeat/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-xy3kxj6b/opbeat/pip-egg-info
         cwd: /tmp/pip-install-xy3kxj6b/opbeat/
    Complete output (10 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-xy3kxj6b/opbeat/setup.py", line 28, in <module>
        from opbeat.version import VERSION
      File "/tmp/pip-install-xy3kxj6b/opbeat/opbeat/__init__.py", line 20, in <module>
        from opbeat.base import *
      File "/tmp/pip-install-xy3kxj6b/opbeat/opbeat/base.py", line 122
        async=None, async_mode=None, traces_send_freq_secs=None,
        ^
    SyntaxError: invalid syntax
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

aldryn-django migrate does not return the correct exit code

The code (https://github.com/aldryn/aldryn-django/blob/e423a97797225c26d3f484bb0dd4a69332d786e8/aldryn_django/cli.py#L58) suggests it should work. But in practice it does not:

calling python manage.py syncdb --noinput directly works as expected. exit code is 1.

root@77be7af91397:/app# python manage.py syncdb --noinput
Starting new HTTPS connection (1): control.local.aldryn.net
/virtualenv/lib/python2.7/site-packages/aldryn_boilerplates/template_loaders.py:5: RemovedInDjango19Warning: django.utils.importlib will be removed in Django 1.9.
  from django.utils.importlib import import_module

/virtualenv/lib/python2.7/site-packages/aldryn_boilerplates/template_loaders.py:5: RemovedInDjango19Warning: django.utils.importlib will be removed in Django 1.9.
  from django.utils.importlib import import_module

Registering auto field: djangocms_link.fields.PageSearchField
Registering new field: djangocms_link.fields.PageSearchField; With actual id: ba6ec61ac643ff9dbf891ddb693187a65704858a
System check identified some issues:

WARNINGS:
?: (1_8.W001) The standalone TEMPLATE_* settings were deprecated in Django 1.8 and the TEMPLATES dictionary takes precedence. You must put the values of the following settings into your default TEMPLATES dict: TEMPLATE_DIRS, ALLOWED_INCLUDE_ROOTS, TEMPLATE_CONTEXT_PROCESSORS, TEMPLATE_LOADERS.
/virtualenv/lib/python2.7/site-packages/django/core/management/commands/syncdb.py:24: RemovedInDjango19Warning: The syncdb command will be removed in Django 1.9
  warnings.warn("The syncdb command will be removed in Django 1.9", RemovedInDjango19Warning)

/virtualenv/lib/python2.7/site-packages/django/core/management/commands/syncdb.py:24: RemovedInDjango19Warning: The syncdb command will be removed in Django 1.9
  warnings.warn("The syncdb command will be removed in Django 1.9", RemovedInDjango19Warning)

Operations to perform:
  Synchronize unmigrated apps: aldryn_devsync, mptt, aldryn_boilerplates, aldryn_django_cms, aldryn_django, staticfiles, parler, messages, djangocms_admin_style, sitemaps, compressor, aldryn_addons, polymorphic, django_select2, sekizai, treebeard
  Apply all migrations: cmsplugin_filer_file, cmsplugin_filer_image, menus, reversion, aldryn_sso, filer, admin, djangocms_link, sessions, robots, auth, sites, captcha, contenttypes, djangocms_googlemap, djangocms_text_ckeditor, cms, easy_thumbnails, djangocms_snippet
Synchronizing apps without migrations:
  Creating tables...
    Running deferred SQL...
  Installing custom SQL...
Running migrations:
  Rendering model states... DONE
  Applying contenttypes.0001_initial...Traceback (most recent call last):
  File "manage.py", line 7, in <module>
    startup.manage(path=os.path.dirname(os.path.abspath(__file__)))
  File "/virtualenv/lib/python2.7/site-packages/aldryn_django/startup.py", line 11, in manage
    utility.execute()
  File "/virtualenv/lib/python2.7/site-packages/django/core/management/__init__.py", line 346, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/virtualenv/lib/python2.7/site-packages/django/core/management/base.py", line 394, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/virtualenv/lib/python2.7/site-packages/django/core/management/base.py", line 445, in execute
    output = self.handle(*args, **options)
  File "/virtualenv/lib/python2.7/site-packages/django/core/management/commands/syncdb.py", line 25, in handle
    call_command("migrate", **options)
  File "/virtualenv/lib/python2.7/site-packages/django/core/management/__init__.py", line 120, in call_command
    return command.execute(*args, **defaults)
  File "/virtualenv/lib/python2.7/site-packages/django/core/management/base.py", line 445, in execute
    output = self.handle(*args, **options)
  File "/virtualenv/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 222, in handle
    executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
  File "/virtualenv/lib/python2.7/site-packages/django/db/migrations/executor.py", line 110, in migrate
    self.apply_migration(states[migration], migration, fake=fake, fake_initial=fake_initial)
  File "/virtualenv/lib/python2.7/site-packages/django/db/migrations/executor.py", line 148, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/virtualenv/lib/python2.7/site-packages/django/db/migrations/migration.py", line 115, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/virtualenv/lib/python2.7/site-packages/django/db/migrations/operations/models.py", line 59, in database_forwards
    schema_editor.create_model(model)
  File "/virtualenv/lib/python2.7/site-packages/django/db/backends/base/schema.py", line 286, in create_model
    self.execute(sql, params or None)
  File "/virtualenv/lib/python2.7/site-packages/django/db/backends/base/schema.py", line 111, in execute
    cursor.execute(sql, params)
  File "/virtualenv/lib/python2.7/site-packages/django/db/backends/utils.py", line 79, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File "/virtualenv/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/virtualenv/lib/python2.7/site-packages/django/db/utils.py", line 98, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/virtualenv/lib/python2.7/site-packages/django/db/backends/utils.py", line 62, in execute
    return self.cursor.execute(sql)
django.db.utils.ProgrammingError: relation "django_content_type" already exists

root@77be7af91397:/app# echo $?
1

calling aldryn-django migrate returns the wrong exit code of 0

root@77be7af91397:/app# aldryn-django migrate
aldryn-django: running migration commands
    ----> CACHE_URL="locmem://" python manage.py createcachetable django_dbcache; exit 0
Starting new HTTPS connection (1): control.local.aldryn.net
/virtualenv/lib/python2.7/site-packages/aldryn_boilerplates/template_loaders.py:5: RemovedInDjango19Warning: django.utils.importlib will be removed in Django 1.9.
  from django.utils.importlib import import_module

/virtualenv/lib/python2.7/site-packages/aldryn_boilerplates/template_loaders.py:5: RemovedInDjango19Warning: django.utils.importlib will be removed in Django 1.9.
  from django.utils.importlib import import_module

Registering auto field: djangocms_link.fields.PageSearchField
Registering new field: djangocms_link.fields.PageSearchField; With actual id: ba6ec61ac643ff9dbf891ddb693187a65704858a
Cache table 'django_dbcache' already exists.





    ----> python manage.py syncdb --noinput
Starting new HTTPS connection (1): control.local.aldryn.net
/virtualenv/lib/python2.7/site-packages/aldryn_boilerplates/template_loaders.py:5: RemovedInDjango19Warning: django.utils.importlib will be removed in Django 1.9.
  from django.utils.importlib import import_module

/virtualenv/lib/python2.7/site-packages/aldryn_boilerplates/template_loaders.py:5: RemovedInDjango19Warning: django.utils.importlib will be removed in Django 1.9.
  from django.utils.importlib import import_module

Registering auto field: djangocms_link.fields.PageSearchField
Registering new field: djangocms_link.fields.PageSearchField; With actual id: ba6ec61ac643ff9dbf891ddb693187a65704858a
System check identified some issues:

WARNINGS:
?: (1_8.W001) The standalone TEMPLATE_* settings were deprecated in Django 1.8 and the TEMPLATES dictionary takes precedence. You must put the values of the following settings into your default TEMPLATES dict: TEMPLATE_DIRS, ALLOWED_INCLUDE_ROOTS, TEMPLATE_CONTEXT_PROCESSORS, TEMPLATE_LOADERS.
/virtualenv/lib/python2.7/site-packages/django/core/management/commands/syncdb.py:24: RemovedInDjango19Warning: The syncdb command will be removed in Django 1.9
  warnings.warn("The syncdb command will be removed in Django 1.9", RemovedInDjango19Warning)

/virtualenv/lib/python2.7/site-packages/django/core/management/commands/syncdb.py:24: RemovedInDjango19Warning: The syncdb command will be removed in Django 1.9
  warnings.warn("The syncdb command will be removed in Django 1.9", RemovedInDjango19Warning)

Operations to perform:
  Synchronize unmigrated apps: aldryn_devsync, mptt, aldryn_boilerplates, aldryn_django_cms, aldryn_django, staticfiles, parler, messages, djangocms_admin_style, sitemaps, compressor, aldryn_addons, polymorphic, django_select2, sekizai, treebeard
  Apply all migrations: cmsplugin_filer_file, cmsplugin_filer_image, menus, reversion, aldryn_sso, filer, admin, djangocms_link, sessions, robots, auth, sites, captcha, contenttypes, djangocms_googlemap, djangocms_text_ckeditor, cms, easy_thumbnails, djangocms_snippet
Synchronizing apps without migrations:
  Creating tables...
    Running deferred SQL...
  Installing custom SQL...
Running migrations:
  Rendering model states... DONE
  Applying contenttypes.0001_initial...Traceback (most recent call last):
  File "manage.py", line 7, in <module>
    startup.manage(path=os.path.dirname(os.path.abspath(__file__)))
  File "/virtualenv/lib/python2.7/site-packages/aldryn_django/startup.py", line 11, in manage
    utility.execute()
  File "/virtualenv/lib/python2.7/site-packages/django/core/management/__init__.py", line 346, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/virtualenv/lib/python2.7/site-packages/django/core/management/base.py", line 394, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/virtualenv/lib/python2.7/site-packages/django/core/management/base.py", line 445, in execute
    output = self.handle(*args, **options)
  File "/virtualenv/lib/python2.7/site-packages/django/core/management/commands/syncdb.py", line 25, in handle
    call_command("migrate", **options)
  File "/virtualenv/lib/python2.7/site-packages/django/core/management/__init__.py", line 120, in call_command
    return command.execute(*args, **defaults)
  File "/virtualenv/lib/python2.7/site-packages/django/core/management/base.py", line 445, in execute
    output = self.handle(*args, **options)
  File "/virtualenv/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 222, in handle
    executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
  File "/virtualenv/lib/python2.7/site-packages/django/db/migrations/executor.py", line 110, in migrate
    self.apply_migration(states[migration], migration, fake=fake, fake_initial=fake_initial)
  File "/virtualenv/lib/python2.7/site-packages/django/db/migrations/executor.py", line 148, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/virtualenv/lib/python2.7/site-packages/django/db/migrations/migration.py", line 115, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/virtualenv/lib/python2.7/site-packages/django/db/migrations/operations/models.py", line 59, in database_forwards
    schema_editor.create_model(model)
  File "/virtualenv/lib/python2.7/site-packages/django/db/backends/base/schema.py", line 286, in create_model
    self.execute(sql, params or None)
  File "/virtualenv/lib/python2.7/site-packages/django/db/backends/base/schema.py", line 111, in execute
    cursor.execute(sql, params)
  File "/virtualenv/lib/python2.7/site-packages/django/db/backends/utils.py", line 79, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File "/virtualenv/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/virtualenv/lib/python2.7/site-packages/django/db/utils.py", line 98, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/virtualenv/lib/python2.7/site-packages/django/db/backends/utils.py", line 62, in execute
    return self.cursor.execute(sql)
django.db.utils.ProgrammingError: relation "django_content_type" already exists

root@77be7af91397:/app# echo $?
0

Processing does seem to stop after the first failed command though (python manage.py migrate... is never called).
Probably click is swallowing the exit code.

Issue with GzipFile in future versions of Python

/usr/local/lib/python3.9/site-packages/aldryn_django/storage.py:71: FutureWarning: GzipFile was opened for writing, but this will change in future Python releases.  Specify the mode argument for opening it for writing.
  with gzip.GzipFile(fileobj=f_out) as gz_out:

Error running "aldryn_optimize_static_images.py" on Python 3.5:

Just in case somebody else has the same. Following error occurs when running the aldryn_optimize_static_images.py command:

  File "/virtualenv/lib/python3.5/site-packages/aldryn_django/management/commands/aldryn_optimize_static_images.py", line 64, in optimize
    shutil.copyfileobj(image, temp_image)
  File "/virtualenv/lib/python3.5/shutil.py", line 73, in copyfileobj
    buf = fsrc.read(length)
  File "/virtualenv/lib/python3.5/codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte

A quick fix for me was changing the read and write mode in aldryn_optimize_static_images.py to binary:

def optimize(self, storage, path, image_type, command):
    with NamedTemporaryFile() as temp_image:
        # Copy the image to the temporary file
        with storage.open(path, 'rb+') as image:
            shutil.copyfileobj(image, temp_image)
        temp_image.flush()
        temp_image.seek(0)

        # Optimize the image
        optimize_command = command.format(filename=temp_image.name)
        self.stdout.write('>>> {}'.format(optimize_command))
        subprocess.check_call(optimize_command, shell=True)
        self.stdout.write('')

        # Save the image back from the temporary file into the storage
        with open(temp_image.name, 'wb+') as fh:
            storage.delete(path)
            storage.save(path, File(fh))

EDIT:
Actually, the second open() would then write a 0-byte file...
I changed the optimize method as following:

    def optimize(self, storage, path, image_type, command):
        with NamedTemporaryFile() as temp_image:
            # Copy the image to the temporary file
            with storage.open(path, 'rb+') as image:
                shutil.copyfileobj(image, temp_image)
            temp_image.flush()
            temp_image.seek(0)

            # Optimize the image
            optimize_command = command.format(filename=temp_image.name)
            self.stdout.write('>>> {}'.format(optimize_command))
            subprocess.check_call(optimize_command, shell=True)
            self.stdout.write('')

            storage.delete(path)
            storage.save(path, File(temp_image))

reconnect to db after connection failure

It seems like a django process will not recover from a connection problem itself. Restarting the process reconnects the db connection.

Django should detect this and reconnect automatically when the database connection is available again.

easy-thumbnail==2.2.1.1 requirement is not met

When i attempt to do:

pip install git+https://github.com/aldryn/aldryn-django.git@support/1.8.x
i get message:

Collecting easy-thumbnails==2.2.1.1 (from aldryn-django==1.8.16.0)
Could not find a version that satisfies the requirement easy-thumbnails==2.2.1.1 (from aldryn-django==1.8.16.0) (from versions: 1.0a2, 1.0a3, 1.0a4, 1.0a5, 1.0a6, 1.0a7, 1.0a8, 1.0a9, 1.0a10, 1.0a11, 1.0a12, 1.0a13, 1.0a14, 1.0a15, 1.0a16, 1.0a17, 1.0a18, 1.0a19, 1.0a20, 1.0a21, 1.0, 1.0.1, 1.0.2, 1.0.3, 1.1, 1.2, 1.3, 1.4, 1.5, 2.0, 2.0.1, 2.1, 2.2, 2.2.1, 2.3)
No matching distribution found for easy-thumbnails==2.2.1.1 (from aldryn-django==1.8.16.0)

'LANGUAGE_CODE "%s" must have a matching entry in LANGUAGES' % settings.LANGUAGE_CODE

Here is the traceback:

Traceback (most recent call last):
  File "manage.py", line 7, in <module>
    startup.manage(path=os.path.dirname(os.path.abspath(__file__)))
  File "/virtualenv/lib/python3.5/site-packages/aldryn_django/startup.py", line 11, in manage
    utility.execute()
  File "/virtualenv/lib/python3.5/site-packages/django/core/management/__init__.py", line 328, in execute
    django.setup()
  File "/virtualenv/lib/python3.5/site-packages/django/__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/virtualenv/lib/python3.5/site-packages/django/apps/registry.py", line 115, in populate
    app_config.ready()
  File "/virtualenv/lib/python3.5/site-packages/django/contrib/admin/apps.py", line 22, in ready
    self.module.autodiscover()
  File "/virtualenv/lib/python3.5/site-packages/django/contrib/admin/__init__.py", line 24, in autodiscover
    autodiscover_modules('admin', register_to=site)
  File "/virtualenv/lib/python3.5/site-packages/django/utils/module_loading.py", line 74, in autodiscover_modules
    import_module('%s.%s' % (app_config.name, module_to_search))
  File "/virtualenv/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 665, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/virtualenv/lib/python3.5/site-packages/cms/admin/__init__.py", line 2, in <module>
    import cms.admin.pageadmin
  File "/virtualenv/lib/python3.5/site-packages/cms/admin/pageadmin.py", line 41, in <module>
    from cms.admin.forms import (
  File "/virtualenv/lib/python3.5/site-packages/cms/admin/forms.py", line 85, in <module>
    class PageForm(forms.ModelForm):
  File "/virtualenv/lib/python3.5/site-packages/cms/admin/forms.py", line 86, in PageForm
    language = forms.ChoiceField(label=_("Language"), choices=get_language_tuple(),
  File "/virtualenv/lib/python3.5/site-packages/cms/utils/i18n.py", line 79, in get_language_tuple
    return [(lang['code'], lang['name']) for lang in get_languages(site_id)]
  File "/virtualenv/lib/python3.5/site-packages/cms/utils/i18n.py", line 24, in get_languages
    result = get_cms_setting('LANGUAGES').get(site_id)
  File "/virtualenv/lib/python3.5/site-packages/cms/utils/conf.py", line 278, in get_cms_setting
    return COMPLEX[name]()
  File "/virtualenv/lib/python3.5/site-packages/cms/utils/conf.py", line 233, in get_languages
    'LANGUAGE_CODE "%s" must have a matching entry in LANGUAGES' % settings.LANGUAGE_CODE
django.core.exceptions.ImproperlyConfigured: LANGUAGE_CODE "en-us" must have a matching entry in LANGUAGES
ERROR: Service 'web' failed to build: The command '/bin/sh -c DJANGO_MODE=build python manage.py collectstatic --noinput' returned a non-zero code: 1
--------------------------------------------------------------------------------
There was an error trying to run a command. This is most likely
not an issue with divio-cli, but the called program itself.
Try checking the output of the command above.
The command was:
  docker-compose -f /home/leo/divio/unicofa/docker-compose.yml build

Here is my settings file:

INSTALLED_ADDONS = [
# <INSTALLED_ADDONS> # Warning: text inside the INSTALLED_ADDONS tags is auto-generated. Manual changes will be overwritten.
'aldryn-addons',
'aldryn-django',
'aldryn-sso',
'aldryn-django-cms',
'aldryn-devsync',
'aldryn-bootstrap3',
'aldryn-categories',
'aldryn-django-rest-framework',
'aldryn-forms',
'aldryn-people',
'djangocms-file',
'djangocms-googlemap',
'djangocms-history',
'djangocms-link',
'djangocms-picture',
'djangocms-snippet',
'djangocms-style',
'djangocms-text-ckeditor',
'djangocms-video',
'django-filer',
# </INSTALLED_ADDONS>
]

TIME_ZONE = 'Asia/Taipei'
LANGUAGE_CODE = 'en-us'
USE_I18N = True
LOCALE_PATHS = []

gettext_noop = lambda s: s

LANGUAGES = [
('en-us', gettext_noop('English')),
('zh-hant', gettext_noop('中文')),
]

import aldryn_addons.settings
aldryn_addons.settings.load(locals())

TIME_ZONE configuration is not working

  • The method in aldryn_config.py that sets TIME_ZONE from an env var is never called.

  • USE_TZ is never set to True: how should we handle backwards compatibility?

MEDIA_URL not set correctly

After upgrading to Aldryn Django 4.2.9, we are seeing issues with MEDIA_URL not being set.

Looking at the code, this seems to be a regression as the function is working correctly on Aldryn Django 3.2.23.

Relevant portion of the code for the 3.2 version:

https://github.com/divio/aldryn-django/blob/3.2.23.0/aldryn_config.py#L398

The above has been fixed in version 3.2.14.0, via commit c11004a.

It seems that the 4.2.9 version is using the old&broken MEDIA_URL logic: https://github.com/divio/aldryn-django/blob/4.2.9/aldryn_config.py#L407

I believe the same logic as it's in use since 3.2.14 should work for the 4.2 branch.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.