Friday, August 31, 2018

Cannot find static files when using mod_wsgi and apache

I'm having trouble getting serving static files.

My project is at /home/joel/myappointments
The app is at /home/joel/myappointments/appointments

An example template contains:
<link rel="stylesheet" href="{% static
'appointments/css/bootstrap.4.1.3.min.css' %}">

myappointments/myappointments/settings.py contains:
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.0/howto/static-files/
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static/")

]
STATIC_URL = '/static/'
STATIC_ROOT = '/home/joel/myappointments/static/'
#'/home/joel/myappointments/appointments/static/'

I've tried different options. The present option is after creating
/home/joel/myappointments/static/ and running
python3 manage.py collectstatic

While running the application with:
(venv) root@localhost:/home/joel/myappointments# mod_wsgi-express
start-server wsgi.py --host myopip.com --user www-data --group
www-data --port 80

I get links like:
http://mysite.com/static/appointments/propellor/typography.css
which are broken.
If I use the development server, it all works.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAA%3Diw_8tMZw51trC6W8MbnY5BTxqcHqZFvmwq-pFZ3yrurG4kw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment