Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

appfog django static files

I've a project, actually is the test from appfog (https://github.com/appfog/af-python-django) that run smoothly in localhost. But it does not work, at least static files are not recognized once deployed on appfog. I've changed just the location of tempaltes.

This is the test page http://st-test.eu01.aws.af.cm/ . as well, also the admin pages are without css http://st-test.eu01.aws.af.cm/admin/

this is my configuration (setting.py)

STATIC_ROOT = ''

STATIC_URL = '/static/'

STATICFILES_DIRS = (
)

STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)

i also tried with

STATIC_ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'static')

but nothing changes.

i've tried with doing collectstatic locally and then update the files on the repository, but nothing works.

does anyone of you know how to make it working?

btw, in the template i use {% load staticfiles %} and {% static "css/style.css" %}

like image 864
EsseTi Avatar asked Mar 14 '26 05:03

EsseTi


1 Answers

This works for me:

settings.py:

import os
ROOT_PATH = os.path.dirname(__file__)

STATIC_ROOT = os.path.join(ROOT_PATH, 'static')
STATIC_URL = '/static/'

urls.py:

(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT}),
like image 157
Bonjour Tristesse Avatar answered Mar 17 '26 04:03

Bonjour Tristesse



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!