5

I'm building a django app that requires a javascript file for some ajaxy bits. I would like to package this app so that it can be installed by via easy_install or pip with as little fuss as possible.

But I'm not sure what where to put the static media, particularly the javascript file. On my machine, I have the static media in an external directory, not served by django. All the internal references in my template point to MEDIA_URL.

Is there a standard for where to package/include/attach static media for reusable django apps? Is there a way to package the app so that others can just use it without messing with moving all the javascript/css files, or some way to automate that during the install process?

I'm using django 1.2 -- haven't upgraded the server to 1.3.

1 Answer 1

3

I think the staticfiles app is exactly what you're looking for, unfortunately it's new in Django 1.3. Are you able to upgrade?

From the docs:

django.contrib.staticfiles collects static files from each of your applications (and any other places you specify) into a single location that can easily be served in production.

EDIT: As per Wogan's comment, if you don't want to upgrade to 1.3 then you can use the Staticfiles standalone app. It's what Django's built in staticfiles app was originally derived from.

Sign up to request clarification or add additional context in comments.

2 Comments

Even if you don't want to use django 1.3, you can still use staticfiles as a standalone app. See pypi.python.org/pypi/django-staticfiles
Nope, I can't upgrade to 1.3, but if I can pull it in as a standalone app, we should be good to go!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.