rishatss
@rishatss
Simple Developer ^)

Как указать правильные альясы на static файлы в Django?

Вообщем выкатил на прод всю тему. И тут static файлы не видно. Прикол в том что если запустить через runserver 104.131.99.194:8000/console то все гуд. А если через apache то 104.131.99.194/console Альяс такой на статику.
Alias /static/ /var/www/platform/students-platform/students/static

config apache
<VirtualHost *:80>
    # This is name based virtual hosting. So place an appropriate server name
    #   here. Example: django.devsrv.local
    ServerName  platform.tk
    ServerAdmin rihasultanov@gmail.com

    # This alias makes serving static files possible.
    #   Please note, that this is geared to our settings/common.py
    #   In production environment, you will propably adjust this!
    Alias /static/  /var/www/platform/students-platform/students/static

    # This alias makes serving media files possible.
    #   Please note, that this is geared to our settings/common.py
    #   In production environment, you will propably adjust this!
    Alias /media/  /var/www/platform/students-platform/students/media

    # Insert the full path to the wsgi.py-file here
    WSGIScriptAlias /   /var/www/platform/students-platform/sp/wsgi.py

    # PROCESS_NAME specifies a distinct name of this process
    #   see: https://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIDaemonProcess
    # PATH/TO/PROJECT_ROOT is the full path to your project's root directory,
    #   containing your project files
    # PATH/TO/VIRTUALENV/ROOT: If you are using a virtualenv specify the full
    #   path to its directory.
    #   Generally you must specify the path to Python's site-packages.
    WSGIDaemonProcess   st-platform  python-path=/var/www/platform/students-platform:/var/www/platform/myprojectenv/lib/python3.5/site-packages

    # PROCESS_GROUP specifies a distinct name for the process group
    #   see: https://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIProcessGroup
    WSGIProcessGroup    st-platform

    # Serving static files from this directory
    #   Please note, that this is geared to our settings/common.py
    #   In production environment, you will propably adjust this!
    <Directory /var/www/platform/students-platform/students/static>
        Options -Indexes
        Order deny,allow
        Allow from all
    </Directory>

    # Serving media files from this directory
    #   Please note, that this is geared to our settings/common.py
    #   In production environment, you will propably adjust this!
    <Directory /var/www/platform/students-platform/students/media>
        Options -Indexes
        Order deny,allow
        Allow from all
    </Directory>

    LogLevel warn

    # PROJECT_NAME is used to seperate the log files of this application
    ErrorLog    ${APACHE_LOG_DIR}/st-platform_error.log
    CustomLog   ${APACHE_LOG_DIR}/st-platform_access.log combined
</VirtualHost>



Что может быть не так? Спасибо!

Исходники:
https://github.com/Rishats/students-platform
  • Вопрос задан
  • 322 просмотра
Решения вопроса 1
rishatss
@rishatss Автор вопроса
Simple Developer ^)
Указал STATIC_ROOT = "/var/www/platform/students-platform/static/" в settings.py
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы