1

I have a regular django site, with djangorestframework (v2.3.14) serving restful api under "/api". On local box everything works fine (mac / mavericks), on remote box (Ubuntu 12) the API browser comes up but all the bootstrap stuff is missing (the page looks like it's out of 1992 prototype instead of pretty bootstrap theme i see locally).

All the pip dependencies have been upgraded and are identical. Locally running site through PyCharm, remotely it is running on WSGI.

What can I check to see what the issue is and resolve it??

Siguza
  • 21,155
  • 6
  • 52
  • 89
Diaspar
  • 567
  • 1
  • 5
  • 12

2 Answers2

3

I suppose that under PyCharm on your local machine you are running the development server, which serves static files directly from your apps and projects internal locations.

After every deployment into production (your WSGI server) you need to collect all static files to a single place, your STATIC_ROOT. This is a job for the django management command collectstatic, see Django docs here.

The command may look like this:

# Executing collectstatic (organize static files)
python /path/to/your/project/manage.py collectstatic --noinput

For further details you may also read Django cannot find static files. Need a second pair of eyes, I'm going crazy.

Community
  • 1
  • 1
timo.rieber
  • 3,727
  • 3
  • 32
  • 47
  • Oh, that explains it! interesting distinction between debug vs prod setups in the referenced answer, and pycharm def simplifies things. so this seems to be the recommended way of doing it, gotcha. – Diaspar Jul 16 '14 at 16:21
0

If this question doesn't help, you can quicly fix it making a link under your proyect's static folder

ln -s /your_env_folder/lib/pythonX.X/site-packages/rest_framework/static/rest_framework rest_framework
Community
  • 1
  • 1
cor
  • 3,323
  • 25
  • 46
  • it worked!!! any way to have it be picked up properly automatically though? right now if i do git-clean it'll wipe the link, i think – Diaspar Jul 16 '14 at 16:12
  • I guess you would need to create the link every time you deploy the proyect for the first time. Tools like `fabric` can help with that – cor Jul 16 '14 at 16:19