簡體   English   中英

Mac OS X上的端口上的Django和python 2.7

[英]Django and python 2.7 from ports on Mac OS X

我從Mac OS X 10.7的端口安裝了Django 1.4.1和Python 2.7。 當我嘗試運行manage.py runserver 8000時,出現錯誤:

Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x10bb840d0>>
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/django/core/management/commands/runserver.py", line 91, in inner_run
    self.validate(display_num_errors=True)
  File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 266, in validate
    num_errors = get_validation_errors(s, app)
  File "/Library/Python/2.7/site-packages/django/core/management/validation.py", line 30, in get_validation_errors
    for (app_name, error) in get_app_errors().items():
  File "/Library/Python/2.7/site-packages/django/db/models/loading.py", line 158, in get_app_errors
    self._populate()
  File "/Library/Python/2.7/site-packages/django/db/models/loading.py", line 64, in _populate
    self.load_app(app_name, True)
  File "/Library/Python/2.7/site-packages/django/db/models/loading.py", line 88, in load_app
    models = import_module('.models', app_name)
  File "/Library/Python/2.7/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/Users/rankor777/PycharmProjects/PyCart/PyCartApp/models.py", line 40, in <module>
    class Photo(models.Model):
  File "/Users/rankor777/PycharmProjects/PyCart/PyCartApp/models.py", line 41, in Photo
    title = models.Model(max_length=128)
  File "/Library/Python/2.7/site-packages/django/db/models/base.py", line 289, in __init__
    if args_len > len(self._meta.fields):
AttributeError: 'Model' object has no attribute '_meta'

這是什么,以及如何解決?

我不知道您為什么認為這與MacPorts有關。 追溯顯示錯誤,該錯誤在PyCartApp/models.py第41行中:您已將models.Model(max_length=128)放到這里,我想您打算將models.CharField(max_length=128)放進去。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM