मैं Django 1.7 पर चल रहा हूँ और जब मैं अजगर manage.py विस्थापित चलाने मैं निम्न त्रुटिDjango NameError: नाम 'bPath' परिभाषित नहीं है
File "/home/ymorin007/workspace/sites/jantiyes.com/src/deeds/migrations/0006_auto_20141204_1631.py", line 9, in <module>
class Migration(migrations.Migration):
File "/home/ymorin007/workspace/sites/jantiyes.com/src/deeds/migrations/0006_auto_20141204_1631.py", line 19, in Migration
field=models.ImageField(storage=django.core.files.storage.FileSystemStorage(location=bPath('/home/ymorin007/workspace/sites/jantiyes.com/src/media')), max_length=255, null=True, upload_to=deeds.models.picture_name, blank=True),
NameError: name 'bPath' is not defined
यह मेरा कर्म/models.py
है मिलfrom jantiyes.settings.base import MEDIA_ROOT
upload_storage = FileSystemStorage(location=MEDIA_ROOT)
def picture_name(self, filename):
ext = filename.split('.')[-1]
deedname = re.sub('[ ]', '-', self.text.lower())
filename = "DEED-%s-%s.%s" % (self.id, deedname, ext)
url = "%s" % filename
return url
class Deed(TimeStampedModel):
picture = models.ImageField(upload_to=picture_name, null=True, blank=True, storage=upload_storage, max_length=255)
text = models.CharField(max_length=500)
when = models.DateField(unique=True)
मेरे मीडिया घोषणा:
BASE_DIR = Path(__file__).ancestor(3)
MEDIA_ROOT = BASE_DIR.child("media")
कौन सी लाइब्रेरी 'पथ' से है? मुझे यह 'pathlib' जैसा दिखता नहीं है क्योंकि इसमें' पूर्वज 'विधि नहीं है। –
मैं Django के लिए नया हूं इसलिए वास्तव में यह सुनिश्चित नहीं है कि आप मुझे – Yannick
की जांच करना चाहते हैं, रिकॉर्ड के लिए मैं जानना चाहता हूं कि आपका आयात किस पथ से 'पथ' से है। –