As instructed in the dotcloud tutorial, this is the code in my postinstall
:
#!/bin/sh
python createdb.py
python some_project/manage.py syncdb --noinput
python mkadmin.py
mkdir -p /home/dotcloud/data/media /home/dotcloud/volatile/static
ln -sf /home/dotcloud/volatile/static /home/dotcloud/static
python some_project/manage.py collectstatic --noinput
...nginx.conf
location /media/ { root /home/dotcloud/data ; }
...and settings.py
....
MEDIA_ROOT = '/home/dotcloud/data/media/'
MEDIA_URL = '/media/'
STATIC_ROOT = '/home/dotcloud/volatile/static/'
STATIC_URL = '/static/'
....
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
'some_project',
)
When postinstall
is run, this error is thrown:
OSError: [Errno 2] No such file or directory: '/home/dotcloud/rsync-1346498181296/some_project/static'
I've been on it for a long time and its confusing because the documentation says /static/
is already setup by the python service and links to /home/dotcloud/static
Can someone assist? Everything worked well until I got to setting up the app for static content. Django version is 1.4.1 on Python 2.7
After getting some sleep, I discovered that my 'static' folder was not in the location I specified in my 'settings.py' file.
Also, dotCloud has updated their documentation to warn that '/static/' is no longer automatically created as earlier stated so I changed my postinstall
script to remove the symlink to '/static/' and also adjusted the nginx.conf
file as instructed in the updated documentation.
Reference:
Handlinng static files on dotCloud