मुझे django इकाई परीक्षण चलाने में त्रुटि का सामना करना पड़ रहा है, मैंने पहले इसका अनुभव नहीं किया है, और इसे दोपहर में गुगल रहा है।Django टेस्ट विफल रहा
Error: Database test_unconvention couldn't be flushed. Possible reasons:
* The database isn't running or isn't configured correctly.
* At least one of the expected database tables doesn't exist.
* The SQL was invalid.
Hint: Look at the output of 'django-admin.py sqlflush'. That's the SQL this command wasn't able to run.
The full error: (1146, "Table 'test_unconvention.media_image' doesn't exist")
media_images तालिका जब django-admin.py sqlflush चल जिक्र किया गया और ठीक उत्पन्न करता है जब मैं चलाया जाता है Django manage.py syncdb:
मैं Django manage.py परीक्षण चलाने के बाद टर्मिनल में इस त्रुटि हो रही है ।
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
class Image(models.Model):
local_image = models.ImageField(upload_to="uploads/%Y/%m/%d/", height_field="height", width_field="width", max_length=255, null=True, blank=True)
remote_image = models.CharField(editable=False, max_length=255, null=True, blank=True)
thirdparty_page = models.CharField(editable=False, max_length=255, blank=True, null=True)
size = models.CharField(editable=False, max_length=25, blank=True, null=True)
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
content_object = generic.GenericForeignKey('content_type', 'object_id')
height = models.PositiveIntegerField(editable=False, blank=True, null=True)
width = models.PositiveIntegerField(editable=False, blank=True, null=True)
created_at = models.DateTimeField(editable=False, auto_now_add=True)
updated_at = models.DateTimeField(editable=False, auto_now=True)
def __unicode__(self):
if self.local_image:
return self.local_image.name
else:
return self.remote_image
मैं किसी भी मदद की सराहना करते हैं, मुझे पता है कि अगर मैं और अधिक जानकारी प्रदान करना चाहिए तो कृपया:
यह जो परेशानी हो गया लगता है छवि मॉडल है!
ताकि छवि मॉडल अपने 'मीडिया' अनुप्रयोग में रहता है,? क्या यह निश्चित रूप से आपके इंस्टॉल किए गए ऐप्स में है ताकि इसे testrunner द्वारा सिंक किया जा रहा हो? –
मीडिया ऐप 'एप' नामक ऐप/प्रोजेक्ट के अंदर है, जिसे मैंने अपने install_apps में जोड़ा था। मैंने सूची में 'common.media' जोड़ा और परीक्षण किए गए परीक्षण, धन्यवाद :-) अगर किसी और की एक ही समस्या है, तो यह ध्यान देने योग्य है कि सिंकडब और स्क्लॉल ने मीडिया ऐप को कोई समस्या नहीं उठाई, और केवल प्रबंधन .py परीक्षण विफल रहा। –
कूल। खुशी है कि यह –