nephila / djangocms-multisite

django-multisite support for DjangoCMS
BSD 3-Clause "New" or "Revised" License
26 stars 19 forks source link

ERROR: django.db.utils.ProgrammingError: relation "django_site" does not exist #3

Closed bartmika closed 8 years ago

bartmika commented 8 years ago

I follow the instructions from https://github.com/ecometrica/django-multisite and then I try to test it out. but I get an error. Let me make some notes:

  1. My database is cleared as I ran:

    drop database cloudmasterstudios_db; 
    create database cloudmasterstudios_db;
    GRANT ALL PRIVILEGES ON DATABASE cloudmasterstudios_db to django; 
    ALTER USER django CREATEDB;
  2. I am using Python 3.4
  3. I pretty much installed the following libraries with my requirements.txt file:

    Babel==2.3.4
    Django==1.8.13
    Django-Select2==4.3.2
    Pillow==3.2.0
    Unidecode==0.04.19
    YURL==0.13
    aldryn-apphooks-config==0.2.7
    aldryn-boilerplates==0.7.4
    aldryn-categories==1.0.3
    aldryn-common==1.0.3
    aldryn-disqus==1.0.0
    aldryn-newsblog==1.2.2
    aldryn-people==1.2.1
    aldryn-reversion==1.0.9
    aldryn-translation-tools==0.2.1
    argparse==1.4.0
    backport-collections==0.1
    beautifulsoup4==4.4.1
    click==6.6
    cmsplugin-filer==1.0.1
    dj-database-url==0.4.1
    django-appconf==1.0.2
    django-appdata==0.1.5
    django-classy-tags==0.7.2
    django-cms==3.2.5
    django-compressor==2.0
    django-filer==1.2.0
    django-formtools==1.0
    django-htmlmin==0.9.1
    django-mailgun==0.9.1
    django-mptt==0.8.4
    django-multisite==1.2.5
    django-parler==1.6.3
    django-phonenumber-field==1.1.0
    django-polymorphic==0.8.1
    django-reversion==1.8.7
    django-sekizai==0.9.0
    django-sortedm2m==1.3.0
    django-taggit==0.19.1
    django-treebeard==4.0.1
    djangocms-admin-style==1.2.2
    djangocms-column==1.6.0
    djangocms-googlemap==0.4.0
    djangocms-inherit==0.2.1
    djangocms-installer==0.8.10
    djangocms-link==1.7.2
    djangocms-style==1.7.0
    djangocms-text-ckeditor==2.9.3
    easy-thumbnails==2.3
    gunicorn==19.6.0
    html5lib==0.9999999
    idna==2.1
    lxml==3.6.0
    ordereddict==1.1
    phonenumbers==7.4.2
    phonenumberslite==7.4.2
    psycopg2==2.6.1
    python-dateutil==2.5.3
    python-dotenv==0.5.1
    python-slugify==1.2.0
    pytz==2016.4
    rcssmin==1.0.6
    requests==2.10.0
    requests-file==1.4
    rjsmin==1.0.12
    six==1.10.0
    tldextract==2.0.1
    tzlocal==1.2.2
  4. My settings.py file looks as follows:

    import os
    import dj_database_url
    gettext = lambda s: s
    DATA_DIR = os.path.dirname(os.path.dirname(__file__))
    """
    Django settings for cloudmasterstudios project.
    
    Generated by 'django-admin startproject' using Django 1.8.13.
    
    For more information on this file, see
    https://docs.djangoproject.com/en/1.8/topics/settings/
    
    For the full list of settings and their values, see
    https://docs.djangoproject.com/en/1.8/ref/settings/
    """
    
    # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
    import os
    
    BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    
    from os.path import join, dirname
    from dotenv import load_dotenv
    
    dotenv_path = join(dirname(__file__), '.env')
    load_dotenv(dotenv_path)
    
    def env_var(key, default=None):
    """Retrieves env vars and makes Python boolean replacements"""
    val = os.environ.get(key, default)
    if val == 'True':
       val = True
    elif val == 'False':
       val = False
    return val
    
    # Quick-start development settings - unsuitable for production
    # See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
    
    # SECURITY WARNING: keep the secret key used in production secret!
    SECRET_KEY = env_var("SECRET_KEY")
    
    # SECURITY WARNING: don't run with debug turned on in production!
    DEBUG = env_var("IS_DEBUG")
    
    ALLOWED_HOSTS = [env_var("ALLOWED_HOSTS")]
    
    # The person to contact on error when DEBUG=False
    ADMINS = [(env_var("ADMIN_NAME"), env_var("ADMIN_EMAIL")),]
    
    # Honor the 'X-Forwarded-Proto' header for request.is_secure()
    SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
    
    # Application definition
    
    from multisite import SiteID
    SITE_ID = SiteID(default=1)
    
    ROOT_URLCONF = 'cloudmasterstudios.urls'
    
    WSGI_APPLICATION = 'cloudmasterstudios.wsgi.application'
    
    # Database
    # https://docs.djangoproject.com/en/1.8/ref/settings/#databases
    
    # Internationalization
    # https://docs.djangoproject.com/en/1.8/topics/i18n/
    
    LANGUAGE_CODE = 'en'
    
    TIME_ZONE = 'America/Toronto'
    
    USE_I18N = True
    
    USE_L10N = True
    
    USE_TZ = True
    
    # Static files (CSS, JavaScript, Images)
    # https://docs.djangoproject.com/en/1.8/howto/static-files/
    
    STATIC_URL = '/static/'
    MEDIA_URL = '/media/'
    MEDIA_ROOT = os.path.join(DATA_DIR, 'media')
    STATIC_ROOT = os.path.join(DATA_DIR, 'static')
    
    STATICFILES_DIRS = (
    os.path.join(BASE_DIR, 'cloudmasterstudios', 'static'),
    )
    
    TEMPLATES = [
    {
       'BACKEND': 'django.template.backends.django.DjangoTemplates',
       'DIRS': [os.path.join(BASE_DIR, 'cloudmasterstudios', 'templates'),],
       'OPTIONS': {
           'context_processors': [
               'django.contrib.auth.context_processors.auth',
               'django.contrib.messages.context_processors.messages',
               'django.core.context_processors.i18n',
               'django.core.context_processors.debug',
               'django.core.context_processors.request',
               'django.core.context_processors.media',
               'django.core.context_processors.csrf',
               'django.core.context_processors.tz',
               'sekizai.context_processors.sekizai',
               'django.core.context_processors.static',
               'cms.context_processors.cms_settings',
               'aldryn_boilerplates.context_processors.boilerplate',
           ],
           'loaders': [
               'django.template.loaders.filesystem.Loader',
               'multisite.template_loader.Loader',
               'django.template.loaders.app_directories.Loader',
               'django.template.loaders.eggs.Loader',
               'aldryn_boilerplates.template_loaders.AppDirectoriesLoader',
           ],
       },
    },
    ]
    
    MIDDLEWARE_CLASSES = [
    'htmlmin.middleware.HtmlMinifyMiddleware',
    'cms.middleware.utils.ApphookReloadMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.locale.LocaleMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'multisite.middleware.DynamicSiteMiddleware',
    'cms.middleware.user.CurrentUserMiddleware',
    'cms.middleware.page.CurrentPageMiddleware',
    'cms.middleware.toolbar.ToolbarMiddleware',
    'cms.middleware.language.LanguageCookieMiddleware',
    'htmlmin.middleware.MarkRequestMiddleware',
    ]
    
    INSTALLED_APPS = [
    # Django & Django-CMS
    'djangocms_admin_style',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.admin',
    'django.contrib.sites',
    'django.contrib.sitemaps',
    'django.contrib.staticfiles',
    'django.contrib.messages',
    'cms',
    'menus',
    'sekizai',
    'treebeard',
    'djangocms_text_ckeditor',
    'djangocms_style',
    'djangocms_column',
    'filer',
    'easy_thumbnails',
    'cmsplugin_filer_image',
    'cmsplugin_filer_file',
    'cmsplugin_filer_folder',
    'cmsplugin_filer_teaser',
    'cmsplugin_filer_utils',
    'cmsplugin_filer_video',
    'djangocms_googlemap',
    'djangocms_inherit',
    'djangocms_link',
    'reversion',
    # Django-CMS Blogging
    'aldryn_apphooks_config',
    'aldryn_boilerplates',
    'aldryn_categories',
    'aldryn_newsblog',
    'aldryn_people',
    'aldryn_reversion',
    'aldryn_common',
    'parler',
    'sortedm2m',
    'taggit',
    'aldryn_disqus',
    # Third Party
    'multisite',
    'compressor',
    # Custom
    'cloudmasterstudios'
    ]
    
    LANGUAGES = (
    ## Customize this
    ('en', gettext('en')),
    ('', gettext('')),
    )
    
    CMS_LANGUAGES = {
    ## Customize this
    1: [
       {
           'redirect_on_fallback': True,
           'hide_untranslated': False,
           'code': 'en',
           'public': True,
           'name': gettext('en'),
       },
       {
           'redirect_on_fallback': True,
           'hide_untranslated': False,
           'code': '',
           'public': True,
           'name': gettext(''),
       },
    ],
    'default': {
       'redirect_on_fallback': True,
       'hide_untranslated': False,
       'public': True,
    },
    }
    
    CMS_TEMPLATES = (
    ## Customize this
    ('fullwidth.html', 'Fullwidth'),
    ('sidebar_left.html', 'Sidebar Left'),
    ('sidebar_right.html', 'Sidebar Right')
    )
    
    CMS_PERMISSION = True
    
    CMS_PLACEHOLDER_CONF = {}
    
    # Database
    # https://docs.djangoproject.com/en/1.8/ref/settings/#databases
    
    DATABASES = {
    'default': {
       'CONN_MAX_AGE': 0,
       'ENGINE': 'django.db.backends.postgresql_psycopg2'
    }
    }
    DATABASES['default'] = dj_database_url.config(default=env_var('DATABASE_URL'))
    
    MIGRATION_MODULES = {
    'cmsplugin_filer_folder': 'cmsplugin_filer_folder.migrations_django',
    'cmsplugin_filer_video': 'cmsplugin_filer_video.migrations_django',
    'cmsplugin_filer_file': 'cmsplugin_filer_file.migrations_django',
    'cmsplugin_filer_image': 'cmsplugin_filer_image.migrations_django',
    'cmsplugin_filer_teaser': 'cmsplugin_filer_teaser.migrations_django',
    }
    
    THUMBNAIL_PROCESSORS = (
    'easy_thumbnails.processors.colorspace',
    'easy_thumbnails.processors.autocrop',
    'filer.thumbnail_processors.scale_and_crop_with_subject_location',
    'easy_thumbnails.processors.filters'
    )
    
    ALDRYN_BOILERPLATE_NAME='bootstrap3'
    
    STATICFILES_FINDERS = [
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'aldryn_boilerplates.staticfile_finders.AppDirectoriesFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    ]
    
    # # The cache connection to use for django-multisite.
    # # Default: 'default'
    # CACHE_MULTISITE_ALIAS = 'multisite'
    #
    # # The cache key prefix that django-multisite should use.
    # # Default: '' (Empty string)
    # CACHE_MULTISITE_KEY_PREFIX = ''
    #
    #
    # # Django Caching
    # # https://docs.djangoproject.com/en/dev/topics/cache/
    #
    # CACHES = {
    #     'default': { # (PROD/QA)
    #         'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
    #         'LOCATION': '127.0.0.1:11211',
    #     },
    #     'multisite': {
    #         'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
    #         'TIMEOUT': 60 * 60 * 24,  # 24 hours
    #     },
    # }
    #
    # # Django-CMS Caching
    # # https://docs.django-cms.org/en/develop/how_to/caching.html
    #
    # CMS_CACHE_PREFIX = 'default'
  5. Finally, I run the following command python manage.py migrate and I got the following error in my console:

    Traceback (most recent call last):
    File "manage.py", line 10, in <module>
     execute_from_command_line(sys.argv)
    File "/Users/bartlomiejmika/Developer/rodolfomartinez/cloudmasterstudios/djangocms-cloudmasterstudios/env/lib/python3.4/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
     utility.execute()
    File "/Users/bartlomiejmika/Developer/rodolfomartinez/cloudmasterstudios/djangocms-cloudmasterstudios/env/lib/python3.4/site-packages/django/core/management/__init__.py", line 328, in execute
     django.setup()
    File "/Users/bartlomiejmika/Developer/rodolfomartinez/cloudmasterstudios/djangocms-cloudmasterstudios/env/lib/python3.4/site-packages/django/__init__.py", line 18, in setup
     apps.populate(settings.INSTALLED_APPS)
    File "/Users/bartlomiejmika/Developer/rodolfomartinez/cloudmasterstudios/djangocms-cloudmasterstudios/env/lib/python3.4/site-packages/django/apps/registry.py", line 115, in populate
     app_config.ready()
    File "/Users/bartlomiejmika/Developer/rodolfomartinez/cloudmasterstudios/djangocms-cloudmasterstudios/env/lib/python3.4/site-packages/cms/apps.py", line 12, in ready
     setup()
    File "/Users/bartlomiejmika/Developer/rodolfomartinez/cloudmasterstudios/djangocms-cloudmasterstudios/env/lib/python3.4/site-packages/cms/utils/setup.py", line 65, in setup
     plugin_pool.validate_templates()
    File "/Users/bartlomiejmika/Developer/rodolfomartinez/cloudmasterstudios/djangocms-cloudmasterstudios/env/lib/python3.4/site-packages/cms/plugin_pool.py", line 73, in validate_templates
     loader.get_template(template)
    File "/Users/bartlomiejmika/Developer/rodolfomartinez/cloudmasterstudios/djangocms-cloudmasterstudios/env/lib/python3.4/site-packages/django/template/loader.py", line 35, in get_template
     return engine.get_template(template_name, dirs)
    File "/Users/bartlomiejmika/Developer/rodolfomartinez/cloudmasterstudios/djangocms-cloudmasterstudios/env/lib/python3.4/site-packages/django/template/backends/django.py", line 30, in get_template
     return Template(self.engine.get_template(template_name, dirs))
    File "/Users/bartlomiejmika/Developer/rodolfomartinez/cloudmasterstudios/djangocms-cloudmasterstudios/env/lib/python3.4/site-packages/django/template/engine.py", line 167, in get_template
     template, origin = self.find_template(template_name, dirs)
    File "/Users/bartlomiejmika/Developer/rodolfomartinez/cloudmasterstudios/djangocms-cloudmasterstudios/env/lib/python3.4/site-packages/django/template/engine.py", line 141, in find_template
     source, display_name = loader(name, dirs)
    File "/Users/bartlomiejmika/Developer/rodolfomartinez/cloudmasterstudios/djangocms-cloudmasterstudios/env/lib/python3.4/site-packages/django/template/loaders/base.py", line 13, in __call__
     return self.load_template(template_name, template_dirs)
    File "/Users/bartlomiejmika/Developer/rodolfomartinez/cloudmasterstudios/djangocms-cloudmasterstudios/env/lib/python3.4/site-packages/django/template/loaders/base.py", line 17, in load_template
     template_name, template_dirs)
    File "/Users/bartlomiejmika/Developer/rodolfomartinez/cloudmasterstudios/djangocms-cloudmasterstudios/env/lib/python3.4/site-packages/django/template/loaders/filesystem.py", line 35, in load_template_source
     for filepath in self.get_template_sources(template_name, template_dirs):
    File "/Users/bartlomiejmika/Developer/rodolfomartinez/cloudmasterstudios/djangocms-cloudmasterstudios/env/lib/python3.4/site-packages/multisite/template/loaders/filesystem.py", line 12, in get_template_sources
     domain = Site.objects.get_current().domain
    File "/Users/bartlomiejmika/Developer/rodolfomartinez/cloudmasterstudios/djangocms-cloudmasterstudios/env/lib/python3.4/site-packages/django/contrib/sites/models.py", line 60, in get_current
     return self._get_site_by_id(site_id)
    File "/Users/bartlomiejmika/Developer/rodolfomartinez/cloudmasterstudios/djangocms-cloudmasterstudios/env/lib/python3.4/site-packages/django/contrib/sites/models.py", line 39, in _get_site_by_id
     site = self.get(pk=site_id)
    File "/Users/bartlomiejmika/Developer/rodolfomartinez/cloudmasterstudios/djangocms-cloudmasterstudios/env/lib/python3.4/site-packages/django/db/models/manager.py", line 127, in manager_method
     return getattr(self.get_queryset(), name)(*args, **kwargs)
    File "/Users/bartlomiejmika/Developer/rodolfomartinez/cloudmasterstudios/djangocms-cloudmasterstudios/env/lib/python3.4/site-packages/django/db/models/query.py", line 328, in get
     num = len(clone)
    File "/Users/bartlomiejmika/Developer/rodolfomartinez/cloudmasterstudios/djangocms-cloudmasterstudios/env/lib/python3.4/site-packages/django/db/models/query.py", line 144, in __len__
     self._fetch_all()
    File "/Users/bartlomiejmika/Developer/rodolfomartinez/cloudmasterstudios/djangocms-cloudmasterstudios/env/lib/python3.4/site-packages/django/db/models/query.py", line 965, in _fetch_all
     self._result_cache = list(self.iterator())
    File "/Users/bartlomiejmika/Developer/rodolfomartinez/cloudmasterstudios/djangocms-cloudmasterstudios/env/lib/python3.4/site-packages/django/db/models/query.py", line 238, in iterator
     results = compiler.execute_sql()
    File "/Users/bartlomiejmika/Developer/rodolfomartinez/cloudmasterstudios/djangocms-cloudmasterstudios/env/lib/python3.4/site-packages/django/db/models/sql/compiler.py", line 840, in execute_sql
     cursor.execute(sql, params)
    File "/Users/bartlomiejmika/Developer/rodolfomartinez/cloudmasterstudios/djangocms-cloudmasterstudios/env/lib/python3.4/site-packages/django/db/backends/utils.py", line 79, in execute
     return super(CursorDebugWrapper, self).execute(sql, params)
    File "/Users/bartlomiejmika/Developer/rodolfomartinez/cloudmasterstudios/djangocms-cloudmasterstudios/env/lib/python3.4/site-packages/django/db/backends/utils.py", line 64, in execute
     return self.cursor.execute(sql, params)
    File "/Users/bartlomiejmika/Developer/rodolfomartinez/cloudmasterstudios/djangocms-cloudmasterstudios/env/lib/python3.4/site-packages/django/db/utils.py", line 98, in __exit__
     six.reraise(dj_exc_type, dj_exc_value, traceback)
    File "/Users/bartlomiejmika/Developer/rodolfomartinez/cloudmasterstudios/djangocms-cloudmasterstudios/env/lib/python3.4/site-packages/django/utils/six.py", line 685, in reraise
     raise value.with_traceback(tb)
    File "/Users/bartlomiejmika/Developer/rodolfomartinez/cloudmasterstudios/djangocms-cloudmasterstudios/env/lib/python3.4/site-packages/django/db/backends/utils.py", line 64, in execute
     return self.cursor.execute(sql, params)
    django.db.utils.ProgrammingError: relation "django_site" does not exist
    LINE 1: ..."django_site"."domain", "django_site"."name" FROM "django_si...
                                                            ^

Do you have any ideas why the django-multisite library is causing this?

yakky commented 8 years ago

@bartmika I'm working on the sample project right now. Hopefully I should be able to push it later today

yakky commented 8 years ago

Fixed with sample setup

bartmika commented 8 years ago

I got my project working with your sample project. From interpreting your sample project, here's what I did in addition to your instructions.

  1. I installed this project with this:

    pip install https://github.com/nephila/djangocms-multisite/archive/master.zip
  2. I created two files: urls1.py and urls2.py and copy & pasted your stuff
  3. I copy and pasted your settings.py file and modified it to look as follows:

    import os
    import dj_database_url
    gettext = lambda s: s
    DATA_DIR = os.path.dirname(os.path.dirname(__file__))
    """
    Django settings for cloudmasterstudios project.
    
    Generated by 'django-admin startproject' using Django 1.8.13.
    
    For more information on this file, see
    https://docs.djangoproject.com/en/1.8/topics/settings/
    
    For the full list of settings and their values, see
    https://docs.djangoproject.com/en/1.8/ref/settings/
    """
    
    # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
    import os
    
    BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    
    from os.path import join, dirname
    from dotenv import load_dotenv
    
    dotenv_path = join(dirname(__file__), '.env')
    load_dotenv(dotenv_path)
    
    def env_var(key, default=None):
    """Retrieves env vars and makes Python boolean replacements"""
    val = os.environ.get(key, default)
    if val == 'True':
       val = True
    elif val == 'False':
       val = False
    return val
    
    # Quick-start development settings - unsuitable for production
    # See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
    
    # SECURITY WARNING: keep the secret key used in production secret!
    SECRET_KEY = env_var("SECRET_KEY")
    
    # SECURITY WARNING: don't run with debug turned on in production!
    DEBUG = env_var("IS_DEBUG")
    
    ALLOWED_HOSTS = [env_var("ALLOWED_HOSTS")]
    
    # The person to contact on error when DEBUG=False
    ADMINS = [(env_var("ADMIN_NAME"), env_var("ADMIN_EMAIL")),]
    
    # Honor the 'X-Forwarded-Proto' header for request.is_secure()
    SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
    
    # Application definition
    
    from multisite import SiteID
    SITE_ID = SiteID(default=1)
    
    ROOT_URLCONF = 'cloudmasterstudios.urls1'
    
    WSGI_APPLICATION = 'cloudmasterstudios.wsgi.application'
    
    # Database
    # https://docs.djangoproject.com/en/1.8/ref/settings/#databases
    
    # Internationalization
    # https://docs.djangoproject.com/en/1.8/topics/i18n/
    
    LANGUAGE_CODE = 'en'
    
    TIME_ZONE = 'America/Toronto'
    
    USE_I18N = True
    
    USE_L10N = True
    
    USE_TZ = True
    
    # Static files (CSS, JavaScript, Images)
    # https://docs.djangoproject.com/en/1.8/howto/static-files/
    
    STATIC_URL = '/static/'
    MEDIA_URL = '/media/'
    MEDIA_ROOT = os.path.join(DATA_DIR, 'media')
    STATIC_ROOT = os.path.join(DATA_DIR, 'static')
    
    STATICFILES_DIRS = (
    os.path.join(BASE_DIR, 'cloudmasterstudios', 'static'),
    )
    
    TEMPLATES = [
    {
       'BACKEND': 'django.template.backends.django.DjangoTemplates',
       'DIRS': [os.path.join(BASE_DIR, 'cloudmasterstudios', 'templates'),],
       'OPTIONS': {
           'context_processors': [
               'django.contrib.auth.context_processors.auth',
               'django.contrib.messages.context_processors.messages',
               'django.core.context_processors.i18n',
               'django.core.context_processors.debug',
               'django.core.context_processors.request',
               'django.core.context_processors.media',
               'django.core.context_processors.csrf',
               'django.core.context_processors.tz',
               'sekizai.context_processors.sekizai',
               'django.core.context_processors.static',
               'cms.context_processors.cms_settings',
               'aldryn_boilerplates.context_processors.boilerplate',
           ],
           'loaders': [
               'django.template.loaders.filesystem.Loader',
               'django.template.loaders.app_directories.Loader',
               'django.template.loaders.eggs.Loader',
               'aldryn_boilerplates.template_loaders.AppDirectoriesLoader',
           ],
       },
    },
    ]
    
    MIDDLEWARE_CLASSES = [
    'htmlmin.middleware.HtmlMinifyMiddleware',
    'cms.middleware.utils.ApphookReloadMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.locale.LocaleMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'cms.middleware.user.CurrentUserMiddleware',
    'cms.middleware.page.CurrentPageMiddleware',
    'cms.middleware.toolbar.ToolbarMiddleware',
    'cms.middleware.language.LanguageCookieMiddleware',
    'multisite.middleware.DynamicSiteMiddleware',
    'djangocms_multisite.middleware.CMSMultiSiteMiddleware',
    'htmlmin.middleware.MarkRequestMiddleware',
    ]
    
    INSTALLED_APPS = [
    # Django & Django-CMS
    'djangocms_admin_style',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.admin',
    'django.contrib.sites',
    'django.contrib.sitemaps',
    'django.contrib.staticfiles',
    'django.contrib.messages',
    'cms',
    'menus',
    'sekizai',
    'treebeard',
    'djangocms_text_ckeditor',
    'djangocms_style',
    'djangocms_column',
    'filer',
    'easy_thumbnails',
    'cmsplugin_filer_image',
    'cmsplugin_filer_file',
    'cmsplugin_filer_folder',
    'cmsplugin_filer_teaser',
    'cmsplugin_filer_utils',
    'cmsplugin_filer_video',
    'djangocms_googlemap',
    'djangocms_inherit',
    'djangocms_link',
    'reversion',
    # Django-CMS Blogging
    'aldryn_apphooks_config',
    'aldryn_boilerplates',
    'aldryn_categories',
    'aldryn_newsblog',
    'aldryn_people',
    'aldryn_reversion',
    'aldryn_common',
    'parler',
    'sortedm2m',
    'taggit',
    'aldryn_disqus',
    'multisite',
    'djangocms_multisite',
    # Third Party
    'compressor',
    # Custom
    'cloudmasterstudios',
    ]
    
    LANGUAGES = (
    ## Customize this
    ('en', gettext('en')),
    ('', gettext('')),
    )
    
    CMS_LANGUAGES = {
    ## Customize this
    1: [
       {
           'redirect_on_fallback': True,
           'hide_untranslated': False,
           'code': 'en',
           'public': True,
           'name': gettext('en'),
       },
       {
           'redirect_on_fallback': True,
           'hide_untranslated': False,
           'code': '',
           'public': True,
           'name': gettext(''),
       },
    ],
    'default': {
       'redirect_on_fallback': True,
       'hide_untranslated': False,
       'public': True,
    },
    }
    
    CMS_TEMPLATES = (
    ## Customize this
    ('fullwidth.html', 'Fullwidth'),
    ('sidebar_left.html', 'Sidebar Left'),
    ('sidebar_right.html', 'Sidebar Right')
    )
    
    CMS_PERMISSION = True
    
    CMS_PLACEHOLDER_CONF = {}
    
    # Database
    # https://docs.djangoproject.com/en/1.8/ref/settings/#databases
    
    DATABASES = {
    'default': {
       'CONN_MAX_AGE': 0,
       "ENGINE": "django.db.backends.postgresql_psycopg2"
    }
    }
    DATABASES['default'] = dj_database_url.config(default=env_var("DATABASE_URL"))
    
    MIGRATION_MODULES = {
    'cmsplugin_filer_folder': 'cmsplugin_filer_folder.migrations_django',
    'cmsplugin_filer_video': 'cmsplugin_filer_video.migrations_django',
    'cmsplugin_filer_file': 'cmsplugin_filer_file.migrations_django',
    'cmsplugin_filer_image': 'cmsplugin_filer_image.migrations_django',
    'cmsplugin_filer_teaser': 'cmsplugin_filer_teaser.migrations_django',
    }
    
    THUMBNAIL_PROCESSORS = (
    'easy_thumbnails.processors.colorspace',
    'easy_thumbnails.processors.autocrop',
    'filer.thumbnail_processors.scale_and_crop_with_subject_location',
    'easy_thumbnails.processors.filters'
    )
    
    ALDRYN_BOILERPLATE_NAME='bootstrap3'
    
    STATICFILES_FINDERS = [
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'aldryn_boilerplates.staticfile_finders.AppDirectoriesFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    ]
    
    MULTISITE_CMS_URLS = {
    'www.example.com': 'cloudmasterstudios.urls1',
    'www.example2.com': 'cloudmasterstudios.urls2',
    }
    MULTISITE_CMS_ALIASES = {
    'www.example.com': ('alias1.example.com', 'alias2.example.com',),
    'www.example2.com': ('alias1.example2.com', 'alias2.example2.com',),
    }
    MULTISITE_CMS_FALLBACK = 'www.example.com'
    
    # # The cache connection to use for django-multisite.
    # # Default: 'default'
    # CACHE_MULTISITE_ALIAS = 'multisite'
    #
    # # The cache key prefix that django-multisite should use.
    # # Default: '' (Empty string)
    # CACHE_MULTISITE_KEY_PREFIX = ''
    #
    #
    #
    # CACHES = {
    #     'default': { # (PROD/QA)
    #         'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache',
    #         'LOCATION': '127.0.0.1:11211',
    #     },
    #     'multisite': {
    #         'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
    #         'TIMEOUT': 60 * 60 * 24,  # 24 hours
    #     },
    # }
    #
    # # Django-CMS Caching
    # # https://docs.django-cms.org/en/develop/how_to/caching.html
    #
    # CMS_CACHE_PREFIX = 'default'
  4. I updated my host file as you specified.
  5. I ran locally this command:

    sudo python manage.py runserver example.com:8000;
    
    [AND WORKS WITH]
    
    python manage.py runserver
  6. I created that super ser and then logged in and create a temporary page with url: http://example.com:8000/admin/ and http://example2.com:8000/admin/
  7. Afterward the links http://example.com:8000/en/ and http://example2.com:8000/en/ I got working.