Difficulty with hosting Multilingual Wagtail site on alwaysdata

12 views Asked by At

my wagtail site has two languages English and German Facing some issues when deploying on alwaysdata.net

I'm using these two apps for the multilingual feature in the INSTALLED_APPS list:

"wagtail.locales",
"wagtail.contrib.simple_translation",

This is the middleware:

"django.middleware.locale.LocaleMiddleware",

these are the settings in settings.py:

LANGUAGE_CODE = "en-us" 
TIME_ZONE = "UTC" 
USE_I18N = True 
WAGTAIL_I18N_ENABLED = True 
USE_L10N = True 
USE_TZ = True

WAGTAIL_CONTENT_LANGUAGES = LANGUAGES = [ ('en', "English"), ('de', "German") ] 
WAGTAIL_CONTENT_LANGUAGES_FALLBACK = {'default': 'en',}

I have the following code in the main urls.py file:

urlpatterns += i18n_patterns (
    path("", include(wagtail_urls)),
    prefix_default_language=True,
)

The project is running fine locally and also running fine in production server (with DEBUG=TRUE)

My problem is, In Production server when I set DEBUG to False the multilingual features gets messed up. I have to manually add /en/ or /de/ at the end of the url to see the pages in the browser

for example if I click on the logo (from nav) which has the url set to '/' , it redirects to mydomain.com , but it should be mydomain.com/en/ or mydomain.com/de/ depending on which language currently selected.

with DEBUG=True it redirects to mydomain.com/en/ or mydomain.com/de/ when clicking on the logo(you can say homepage) perfectly.

What am I missing or doing wrong?

Could somebody please guide me through this? I'm happy answer any of your question about the project.

0

There are 0 answers