我试图将 \'comment.html\' 包含到 store.html 中,并 store.html 扩展 base.html。
\n\n但是 Django 抛出错误comment.html (<class \'django.template.base.TemplateDoesNotExist\'>)\n
所有模板都在同一目录中。store.html
工作正常,并且可以正常扩展,base.html
没有任何问题。但是,当我包含comment.html
在store.html
错误中时,会抛出...\n我已使用{% include "comment.html" %}
它来包含comment.html
到store.html
这些文件所在的目录树:\nvaibhav@ubuntu:~/TRAC/bright-coupons/brightCoupons/brightCouponsApp$ tree\n。
\n\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 __init__.py\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 models.py\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 templates\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 about.html\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 base.html\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 comment.html\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 contact.html\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 error.html\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 index.html\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 index-var.html\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 store.html\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 stores.html\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 submit-form.php\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 support.html\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 tags.html\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 tests.py\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 views.py\n
Run Code Online (Sandbox Code Playgroud)\n 我正在尝试更换字符串
self.cursor.execute("select (1) from eScraperInterfaceApp_scrapeddata where productURL = '%s' limit 1") % URL
Run Code Online (Sandbox Code Playgroud)
错误
%不支持的操作数类型:'long'和'unicode'
productURL是unicode所以如何更换它...有人可以帮助我
我有一个模型,在我使用时会抛出错误 python manage.py syncdb
在这一行createdAt = models.DateTimeField(auto_add_now=True)
,错误是
File "/home/vaibhav/TRAC/coupon-rest-api/couponRestApi/couponRestApiApp/models.py", line 18, in tags
createdAt = models.DateTimeField(auto_add_now=True)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/fields/__init__.py", line 660, in __init__
Field.__init__(self, verbose_name, name, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'auto_add_now'
Run Code Online (Sandbox Code Playgroud)
我在这里做错了什么?
我正在废弃一个网站,我在scrapy中写了一个蜘蛛,但我能够使用这个提取产品价格:
hxs.select('//div[@class="product_list"]//div[@class="product_list_offerprice"]/text()').extract()
Run Code Online (Sandbox Code Playgroud)
通过scrapy shell
但是当我试图用蜘蛛做同样的事情时它会返回空列表
这是我的蜘蛛代码:
from eScraper.items import EscraperItem
from scrapy.selector import HtmlXPathSelector
from scrapy.contrib.spiders import CrawlSpider
#------------------------------------------------------------------------------
class ESpider(CrawlSpider):
name = "ashikamallSpider"
allowed_domains = ["ashikamall.com"]
URLSList = []
for n in range (1,51):
URLSList.append('http://ashikamall.com/products.aspx?id=222&page=' + str(n))
start_urls = URLSList
def parse(self, response):
hxs = HtmlXPathSelector(response)
sites = hxs.select('//div[@class="product_list"]')
items = []
for site in sites:
item = EscraperItem()
item['productDesc'] = ""
item['productSite'] = "http://1click1call.com/"
item['productTitle'] = site.select('div[@class="product_list_name"]/h3/text()').extract()
item['productPrice'] = site.select('div[@class="product_list_offerprice"]/text()').extract()
item['productURL'] = "http://ashikamall.com/" + site.select('div[@class="product_list_image"]/a/@href').extract()[0].encode('utf-8')
item['productImage'] …
Run Code Online (Sandbox Code Playgroud) 我有这个模型:
projectDirPath = path.dirname(path.dirname(__file__))
storeImageDir = FileSystemStorage(location=projectDirPath + '/couponRestApiApp/stores')
class stores(models.Model):
""" This is the store model """
storeName = models.CharField(max_length=15) # Store Name
storeDescription = models.TextField() # Store Description
storeURL = models.URLField() # Store URL
storePopularityNumber = models.IntegerField(max_length=1) # Store Popularity Number
storeImage = models.ImageField(upload_to="images",storage=storeImageDir) # Store Image
storeSlug = models.CharField(max_length=400) # This is the text you see in the URL
createdAt = models.DateTimeField(auto_now_add=True) # Time at which store is created
updatedAt = models.DateTimeField(auto_now=True) # Time at which store …
Run Code Online (Sandbox Code Playgroud) 我想根据优惠券的数量对标签进行排序.标签和商店模型具有多对多的关系,商店和优惠券具有一对多的关系.
我的models.py:
class tags(models.Model):
""" This is the tag model """
seo_url = models.URLField() # SEO URL for mypromocodes.in
tagDescription = models.TextField() # Tag Description
tag = models.CharField(max_length=200) # Tag name
tagSlug = models.CharField(max_length=400) # Extra info can be added to the existing tag using this field
updatedAt = models.DateTimeField(auto_now=True) # Time at which tag is updated
createdAt = models.DateTimeField(auto_now_add=True) # Time at which tag is created
hash = models.CharField(max_length=10,unique=True) # Tag Hash for mypromocodes.in
def save(self, *args, **kwargs):
"""Custom …
Run Code Online (Sandbox Code Playgroud) 我刚刚更新了我的models.py,现在我收到错误..这是抛出的错误:
验证模型......
Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x9eb5dec>>
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 91, in inner_run
self.validate(display_num_errors=True)
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 …
Run Code Online (Sandbox Code Playgroud)