按照 dotcloud 教程中的说明,这是我的代码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 ; }
...和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',
)
运行时postinstall
,抛出此错误:
OSError: [Errno 2] No such file or directory: '/home/dotcloud/rsync-1346498181296/some_project/static'
我已经使用它很长时间了,它令人困惑,因为文档说/static/
已经由 python 服务设置并链接到/home/dotcloud/static
有人可以帮忙吗?在我开始为静态内容设置应用程序之前,一切都运行良好。Django 版本是 Python 2.7 上的 1.4.1