部署Django App

时间:2017-08-05 02:25:59

标签: python django amazon-ec2

我正在使用教程回购,现在我想将它部署到EC2实例,它无法正常工作 这是回购,我唯一添加的是ec2-54-197-26-105.compute-1.amazonaws.com

允许主持人。我已经让实例运行了,所以你可以在ec2-54-197-26-105.compute-1.amazonaws.com上访问它。

REPO https://bitbucket.org/trackstarz/clab 这是输出

KeyError at /accounts/logout
'en-us'
Request Method: GET
Request URL:    http://ec2-54-197-26-105.compute-1.amazonaws.com/accounts/logout
Django Version: 1.11.4
Exception Type: KeyError
Exception Value:    
'en-us'
Exception Location: /home/ubuntu/clab/denv/local/lib/python2.7/site-packages/django/urls/resolvers.py in reverse_dict, line 335
Python Executable:  /home/ubuntu/clab/denv/bin/python
Python Version: 2.7.6
Python Path:    
['/home/ubuntu/clab',
 '/home/ubuntu/clab/denv/bin',
 '/home/ubuntu/clab/denv/lib/python2.7',
 '/home/ubuntu/clab/denv/lib/python2.7/plat-x86_64-linux-gnu',
 '/home/ubuntu/clab/denv/lib/python2.7/lib-tk',
 '/home/ubuntu/clab/denv/lib/python2.7/lib-old',
 '/home/ubuntu/clab/denv/lib/python2.7/lib-dynload',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-x86_64-linux-gnu',
 '/usr/lib/python2.7/lib-tk',
 '/home/ubuntu/clab/denv/local/lib/python2.7/site-packages',
 '/home/ubuntu/clab/denv/lib/python2.7/site-packages']
Server time:    Sat, 5 Aug 2017 01:58:31 +0000
Error during template rendering

In template /home/ubuntu/clab/courses/templates/base.html, error at line 16
en-us
6       <title>{% block title %}Educa{% endblock %}</title>
7       <link href="{% static "css/base.css" %}" rel="stylesheet">
8   </head>
9   <body>
10      <div id="header">
11          <a href="/" class="logo">Educa</a>
12          <ul class="menu">
13              {% if request.user.is_authenticated %}
14                  <li><a href="{% url "logout" %}">Sign out</a></li>
15              {% else %}
16          <li><a href="{% url "login" %}">Sign in</a></li>

我不知道从哪里开始。 requirement.txt具有以下内容 Django的 Django的括号 gunicorn

提前谢谢你。

1 个答案:

答案 0 :(得分:0)

如果它适用于您的计算机但不适用于服务器,则可能是由于版本不同或包丢失。您可以使用python --version检查python版本,使用pip freeze检查python包。

如果事实证明它在您的计算机上也不起作用,则代码中存在错误。错误消息显示第16行存在KeyError,表明您未将名称login分配给URL。