0

I've deployed my Django project on DigitalOcean.com. I've set static folder and run python manage.py collectstatic which worked correctly. The only problem is that I can't see select all checkbox in admin page.

This is in my local Django project:

enter image description here

And this is in deployed project:

enter image description here

I can't figure out where the problem is. Do you know?

I'm attaching settings.py of deployed project:

import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'some key'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False

ALLOWED_HOSTS = ['*']


# Application definition

INSTALLED_APPS = [


    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'main_app',
    'django.contrib.admin',
    'django_tables2',
    'import_export',
]

MIDDLEWARE_CLASSES = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'drevo.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'drevo.wsgi.application'


# Database
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME':'/home/django/drevo/db.sqlite3',
        #'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}


# Password validation
# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'email@gmail.com'
EMAIL_HOST_PASSWORD = 'pwd'

ADMIN_EMAIL = 'email@gmail.com'

# Internationalization
# https://docs.djangoproject.com/en/1.9/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True

VARS_MODULE_PATH = 'main_app.global_variables.py'
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.9/howto/static-files/

STATIC_ROOT = '/home/django/drevo/static/'
STATIC_URL = '/static/'
Milano
  • 18,048
  • 37
  • 153
  • 353

2 Answers2

2

I had the same problem and fixed it backing up all data in my static folder, emptying it and executing again:

python manage.py collectstatic

I figured out it was because of static files from a previous app I had installed (django-grappelli). Django was trying to move file needed to the destination /static/ folder, but as there were already the same files created by django-grapelli it just ignored them and doesn't moved them. Example:

Found another file with the destination path 'admin/css/dashboard.css'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.

Emptying the folder I forced the command to recopy everything bak there and everything worked fine afterwards.

m4tti
  • 55
  • 8
0

I just faced the same issue (at least same effects). It turned out to be (I think) a cache issue, either on nginx or on the client browser:

My production server works with Debian jessie, nginx, gunicorn, Django 1.10.2 + SSL.

To test if you have a cache problem, run (if your prod server allows this)

./manage.py runserver 0.0.0.0:8000

(or any other port you can access) on your production server for a short while. And test there if the checkbox is present. If yes, than just restart your server services and force the browser cache refresh a few times (hit shift+click on the refresh arrow on most of the browser I know).

Bob Morane
  • 183
  • 1
  • 7