Collectstatic not working

2,030 views
Skip to first unread message

Satinderpal Singh

unread,
Feb 10, 2013, 3:20:03 PM2/10/13
to django...@googlegroups.com
I am trying to configure the static files for my project by following the Django guide https://docs.djangoproject.com/en/dev/howto/static-files/
 My project is like this:

     Automation
     |
     |-----static
     |     |
     |     |-----css
     |     |-----js
     |-----__init__.py
     |-----settings.py
     |-----urls.py
     |-----wsgi.py
     |
     |-----myapp
     |
     |-----templates

PROJECT_PATH = os.path.dirname(os.path.abspath(__file__))
STATIC_ROOT = os.path.join(PROJECT_PATH,'static')
STATICFILES_DIRS = (
                                             os.path.join(PROJECT_PATH, 'static'), 
)
On running ./manage.py  collectstatic     in the terminal, gives following message.

    "The STATICFILES_DIRS setting should "
django.core.exceptions.ImproperlyConfigured: The STATICFILES_DIRS setting should not contain the STATIC_ROOT setting
 
How could i solve this problem.

--
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

Lucas Magnum

unread,
Feb 10, 2013, 3:37:22 PM2/10/13
to django...@googlegroups.com
Remove the 
 os.path.join(PROJECT_PATH, 'static'), 
From staticfiles_dir by default this already included.



[]'s

Lucas Magnum.


2013/2/10 Satinderpal Singh <satinder...@gmail.com>

--
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...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Brad

unread,
Feb 10, 2013, 3:41:03 PM2/10/13
to django...@googlegroups.com
The problem is that you have your STATIC_ROOT as one of the
STATICFILES_DIRS. The STATIC_ROOT directory should be empty, that is
where all the static files from different places will be gathered when
you run collectstatic. You should probably create a static directory
under the myapp directory and move all your static files there. Leave
the STATIC_ROOT setting as you have it now, and don't specify
STATICFILES_DIRS. By default django looks in static directories under
all apps in INSTALLED_APPS.

Satinderpal Singh

unread,
Feb 10, 2013, 4:09:45 PM2/10/13
to django...@googlegroups.com
Thanks a lot Lucas and Brad. 


On Mon, Feb 11, 2013 at 2:11 AM, Brad <bradp...@gmail.com> wrote:
The problem is that you have your STATIC_ROOT as one of the
STATICFILES_DIRS. The STATIC_ROOT directory should be empty, that is
where all the static files from different places will be gathered when
you run collectstatic. You should probably create a static directory
under the myapp directory and move all your static files there.
I tried this way, but it makes a directory "admin" inside the project, which further contains the "css" "image" and "js" folders inside it. Are you asked about this or a different static directory for "myapp".
Leave
the STATIC_ROOT setting as you have it now, and don't specify
STATICFILES_DIRS. By default django looks in static directories under
all apps in INSTALLED_APPS.
 Thanks, it works for me, and collectstatic made a directory inside the project. But not any change occur in the project, with default css and js. How could it works.

On Mon, 2013-02-11 at 01:50 +0530, Satinderpal Singh wrote:
> On running ./manage.py  collectstatic     in the terminal, gives
> following message.
>
>
>
>     "The STATICFILES_DIRS setting should "
> django.core.exceptions.ImproperlyConfigured: The STATICFILES_DIRS
> setting should not contain the STATIC_ROOT setting


--
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...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply all
Reply to author
Forward
0 new messages