我试图把它推到Heroku网站,到目前为止我可以在本地运行它没有任何问题。但当我把它推到Heroku时,我遇到了这些错误。我不明白这些错误,我试图在互联网上搜索这些错误代码。不幸的是,我找不到任何关于它的东西。如果您对此有所了解,请帮我找到解决方案。感谢。
当我尝试链接到Heroku域中的页面时,这是一个错误。
var reader = new FileReader();
reader.onload = function() {
// do stuff with `data URI` of `image.data`
console.log(reader.result);
}
reader.readAsDataURL(new Blob([image.data], {type:image.mime}));
这是我的setting.py。
Environment:
Request Method: GET
Request URL: https://pawkanstyleblog.herokuapp.com/
Django Version: 1.10.5
Python Version: 3.5.2
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'web.firstpage',
'django_ajax']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
Template error:
In template /app/web/firstpage/templates/firstpage/index.html, error at line 47
relation "firstpage_project" does not exist
LINE 1: ..."."create_date", "firstpage_project"."image" FROM "firstpage...
^
37 : </h1>
38 : <h1 class="text-center hidden-md-up" >PROJECTS</h1>
39 : <i class="fa fa-grav fa-5x pl-4 hidden-sm-down" aria-hidden="true" ></i>
40 : </div>
41 : <div class="row">
42 : <div class="col-md-12 pt-4">
43 : <div class="card-columns">
44 :
45 : {% load tz %}
46 :
47 : {% for project in projects %}
48 :
49 : <a href="{% url 'firstpage:detail' project.pk %}">
50 : <div class="card ">
51 : <img class="card-img-top img-fluid" src="{{ project.image.url}}" alt="Card image cap">
52 : <div class="card-block" id="card-front">
53 : <h4 class="card-title">{{project.title | title}}</h4>
54 : <p class="card-text">{{project.description | truncatewords:50 }}</p>
55 : <p class="card-text"><small class="text-muted">{{project.create_date | timezone:"Asia/Bangkok"}} </small></p>
56 : </div>
57 : </div>
Traceback:
File "/app/.heroku/python/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
64. return self.cursor.execute(sql, params)
The above exception (relation "firstpage_project" does not exist
LINE 1: ..."."create_date", "firstpage_project"."image" FROM "firstpage...
^
) was the direct cause of the following exception:
File "/app/.heroku/python/lib/python3.5/site-packages/django/core/handlers/exception.py" in inner
39. response = get_response(request)
File "/app/.heroku/python/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
187. response = self.process_exception_by_middleware(e, request)
File "/app/.heroku/python/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
185. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/app/web/firstpage/views.py" in index
15. return render(request,'firstpage/index.html',{'projects': projects,'contacts':contacts})
File "/app/.heroku/python/lib/python3.5/site-packages/django/shortcuts.py" in render
30. content = loader.render_to_string(template_name, context, request, using=using)
File "/app/.heroku/python/lib/python3.5/site-packages/django/template/loader.py" in render_to_string
68. return template.render(context, request)
File "/app/.heroku/python/lib/python3.5/site-packages/django/template/backends/django.py" in render
66. return self.template.render(context)
File "/app/.heroku/python/lib/python3.5/site-packages/django/template/base.py" in render
208. return self._render(context)
File "/app/.heroku/python/lib/python3.5/site-packages/django/template/base.py" in _render
199. return self.nodelist.render(context)
File "/app/.heroku/python/lib/python3.5/site-packages/django/template/base.py" in render
994. bit = node.render_annotated(context)
File "/app/.heroku/python/lib/python3.5/site-packages/django/template/base.py" in render_annotated
961. return self.render(context)
File "/app/.heroku/python/lib/python3.5/site-packages/django/template/loader_tags.py" in render
174. return compiled_parent._render(context)
File "/app/.heroku/python/lib/python3.5/site-packages/django/template/base.py" in _render
199. return self.nodelist.render(context)
File "/app/.heroku/python/lib/python3.5/site-packages/django/template/base.py" in render
994. bit = node.render_annotated(context)
File "/app/.heroku/python/lib/python3.5/site-packages/django/template/base.py" in render_annotated
961. return self.render(context)
File "/app/.heroku/python/lib/python3.5/site-packages/django/template/loader_tags.py" in render
70. result = block.nodelist.render(context)
File "/app/.heroku/python/lib/python3.5/site-packages/django/template/base.py" in render
994. bit = node.render_annotated(context)
File "/app/.heroku/python/lib/python3.5/site-packages/django/template/base.py" in render_annotated
961. return self.render(context)
File "/app/.heroku/python/lib/python3.5/site-packages/django/template/defaulttags.py" in render
166. len_values = len(values)
File "/app/.heroku/python/lib/python3.5/site-packages/django/db/models/query.py" in __len__
238. self._fetch_all()
File "/app/.heroku/python/lib/python3.5/site-packages/django/db/models/query.py" in _fetch_all
1087. self._result_cache = list(self.iterator())
File "/app/.heroku/python/lib/python3.5/site-packages/django/db/models/query.py" in __iter__
54. results = compiler.execute_sql()
File "/app/.heroku/python/lib/python3.5/site-packages/django/db/models/sql/compiler.py" in execute_sql
835. cursor.execute(sql, params)
File "/app/.heroku/python/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
79. return super(CursorDebugWrapper, self).execute(sql, params)
File "/app/.heroku/python/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
64. return self.cursor.execute(sql, params)
File "/app/.heroku/python/lib/python3.5/site-packages/django/db/utils.py" in __exit__
94. six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/app/.heroku/python/lib/python3.5/site-packages/django/utils/six.py" in reraise
685. raise value.with_traceback(tb)
File "/app/.heroku/python/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
64. return self.cursor.execute(sql, params)
Exception Type: ProgrammingError at /
Exception Value: relation "firstpage_project" does not exist
LINE 1: ..."."create_date", "firstpage_project"."image" FROM "firstpage...
^