如何为django安装paintstore? Paintstore来自http://pypi.python.org/pypi/django-paintstore。我用命令
安装了它python setup.py install
安装很顺利,我认为,至少没有错误,但是当我做的时候
python manage.py sql appname
它说
Traceback (most recent call last):
File "manage.py", line 10, in <module> execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 443, in execute_from_command_line utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 382, in execute self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 196, in run_from_argv self.execute(*args, **options.__dict__)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 231, in execute self.validate()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 266, in validate num_errors = get_validation_errors(s, app)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/validation.py", line 30, in get_validation_errors for (app_name, error) in get_app_errors().items():
File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 158, in get_app_errors self._populate()
File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 64, in _populate self.load_app(app_name, True)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 88, in load_app models = import_module('.models', app_name)
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module __import__(name)
File "/ProjectDir/ProjectName/app/models.py", line 7, in <module>
class Bag(models.Model):
File "/ProjectDir/ProjectName/app/models.py", line 10, in Bag Color = models.ColorPickerField()
AttributeError: 'module' object has no attribute 'ColorPickerField'
我尝试在django-paintstore-0.1.2中复制paintstore文件夹的内容(在解压缩django-paintstore-0.1.2.tar.gz文件时得到这个内容),但仍无济于事。 README没有任何帮助,如果它只是说
Install the app with your preferred Python packaging utility
我已经将paintstore添加到了INSTALLED_APPS中,并且我没有忘记使用
导入它from paintstore.fields import ColorPickerField
提前感谢您的帮助。顺便说一下,如果你为ColorPickerField建议别的东西,只要它和这个一样好或者更好,我不介意,但请告诉我如何安装它才能正常工作。
答案 0 :(得分:1)
与使用django模型有点不同。它不是models.ColorPickerField。它应该只是ColorPickerField。