Digital Ocean Apache To Django All Operational Error

Apache to Django Devlopment Server Configaration

Posted by indranil on Jan. 3, 2021, 1 a.m.

Apache To Django All Operational Solution:

//Database Operatioal Error On Apache Server Fixed:

Settings.py  --- Change Your Databasa Directory

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        #'NAME': BASE_DIR / 'db.sqlite3',
        'NAME': '/var/www/sitefly/django-project/db.sqlite3',
    }
}

On Terminal: Go to your Project Directory Database File

chmod 664 www-data: db.sqlite3

sudo chown www-data: db.sqlite3

cd ..

sudo chown www-data: your_project_root/db.sqlite3

sudo chown www-data: your_project_root/

sudo service apache2 restart

//Static File Operatioal Error On Apache Server Fixed:

Settings.py  --- Change Your Static Directory

STATIC_URL = '/static/'

STATICFILES_DIRS = (
    os.path.join(BASE_DIR, 'static'),
)

STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')

Must Be Checked Your 000-default.conf

On Terminal: Go to your Project Directory File

sudo chmod -R 755 'your_static_file_path/static/'

sudo chown www-data: 'your_static_file_path/static/'

sudo service apache2 restart

//Media File Operatioal Error On Apache Server Fixed:

Settings.py  --- Change Your Media Directory

MEDIA_URL="/media/"

MEDIA_ROOT= os.path.join(BASE_DIR, '/var/www/service/django-project/media')

On Terminal: Go to your Project Directory Database File

sudo chown www-data: 'your_media_root/media/'

sudo service apache2 restart

noimg Visit Link: digitalocean.com