So, i'm trying to learn django as well as trying to make an app with Angular and Django REST backend on Apache server via mod_wsgi
. Currently, i got a problem with static files. Everyhing is ok when app runs with Django tools on 127.0.0.1:8000
, but when i load it via Apache - i'm missing statics, so output looks very raw:
I tried to collect statics with manage.py collectstatics
, tried to define a dir with statics in python dirs - got nothing:
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'DjangoApp/static/')
STATICFILES_DIRS = [
'C:/Users/<user>/AppData/Local/Programs/Python/Python36-32/Lib/site-packages/rest_framework/static',
]
Apache virtual host settings:
<VirtualHost 127.0.0.1:8081>
##ServerAdmin webmaster@dummy-host.example.com
WSGIScriptAlias / "D:/genesi5/Coding/www/django/wsgi_handler.wsgi"
DocumentRoot "D:/genesi5/Coding/www/django"
ServerName DjangoApp
ServerAlias DjangoApp
ErrorLog "logs/myapp/error.log"
CustomLog "logs/myapp/access.log" common
<Directory "D:/genesi5/Coding/www/django">
AllowOverride All
Require all Granted
</Directory>
</VirtualHost>
httpd.conf:
LoadModule wsgi_module "C:/Users/Genesi5/AppData/Local/Programs/Python/Python36-32/lib/site-packages/mod_wsgi/server/mod_wsgi.cp36-win32.pyd"
<IfModule wsgi_module>
LoadFile "C:/Users/Genesi5/AppData/Local/Programs/Python/Python36-32/python36.dll"
WSGIPythonHome "C:/Users/Genesi5/AppData/Local/Programs/Python/Python36-32"
WSGIPassAuthorization On
</IfModule>
Can you suggest a solution?