1👍
✅
Solved this by adding the django project name directory before static
so this :
Alias /static /home/alex/djangoproject/static
<Directory /home/alex/djangoproject/static>
Require all granted
</Directory>
Will become this:
Alias /static /home/alex/djangoproject/"django-project-name(in mycase: cpanel)"/static
<Directory /home/alex/djangoproject/"django-project-name(in mycase: cpanel)"/static>
Require all granted
</Directory>
Performed ./migrate.py collectstatic , restart apache and all running smoothly.
1👍
For Ubuntu 20 :
in /etc/apache2/apache2.conf
add after line 175:
<Directory /<project_folder_parent_directory>/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
in /etc/apache2/sites-available/000-default.conf
, use this quick setup:
<VirtualHost *:80>
ServerAlias *
ErrorLog /<wsgi.py_folder_path>/error.log
CustomLog /<wsgi.py_folder_path>/access.log combine
Alias /static /<static_parent_directory_path>/static
<Directory /<project_folder_path>/static>
Order allow,deny
Allow from all
Require all granted
</Directory>
<Directory /<wsgi.py_folder_path>/>
<Files wsgi.py>
Order allow,deny
Allow from all
Require all granted
</Files>
Order allow,deny
Allow from all
Require all granted
</Directory>
#Demon process for multiple virtual hosts
WSGIDaemonProcess projectname python-path=/<project_folder_path>/
# if you're using virtual environment
#WSGIDaemonProcess projectname python-home=/<project_virtual_env_path> python-path=/<project_folder_path>/
WSGIProcessGroup projectname
#Pointing wsgi script to config file
WSGIScriptAlias / /<wsgi.py_folder_path>/wsgi.py
</VirtualHost>
Restart apache :
$ sudo systemctl restart apache2
- [Answered ]-Django Rest Framework – Nested Serialization with intermediary model
- [Answered ]-JQuery/Django Syntax error
Source:stackexchange.com