小编Jon*_*han的帖子

Heroku找不到Django模板

TemplateDoesNotExistHeroku在查找我的html文件时收到错误.这些文件都在开发服务器上同步.该TEMPLATE_DIRS设置设置为:

TEMPLATE_DIRS = ['/Users/jonathanschen/Python/projects/skeleton/myportfolio/templates',]
Run Code Online (Sandbox Code Playgroud)

但是当我尝试加载页面时,我发现了以下错误:我认为这里有一些非常基本的东西.

TemplateDoesNotExist at /
index.html
Request Method: GET
Request URL:    http://morning-coast-2859.herokuapp.com/
Django Version: 1.4.1
Exception Type: TemplateDoesNotExist
Exception Value:    
index.html
Exception Location: /app/.heroku/venv/lib/python2.7/site-packages/django/template/loader.py in find_template, line 138

Template-loader postmortem

Django tried loading these templates, in this order:
Using loader django.template.loaders.filesystem.Loader:
/Users/jonathanschen/Python/projects/skeleton/myportfolio/templates/index.html (File does not exist)
Using loader django.template.loaders.app_directories.Loader:
/app/.heroku/venv/lib/python2.7/site-packages/django/contrib/auth/templates/index.html (File does not exist)
/app/.heroku/venv/lib/python2.7/site-packages/django/contrib/admin/templates/index.html (File does not exist)
Run Code Online (Sandbox Code Playgroud)

python django heroku

3
推荐指数
1
解决办法
4209
查看次数

将字符串列表(csv)转换为浮点列表

我将这个字符串列表转换为浮点列表时遇到了一些困难.我尝试了这两种方式,每种都返回了不同的错误.

import csv
import math

unemp_reader = csv.reader(open('unemp.csv', 'rU'))
unemp_lines = list(unemp_reader)

for rows in unemp_lines:     #tried this way, but error tells me indices must be integers 
    i = 1
    for i in rows:
        a = map(float, unemp_lines[i])
        float_list.append(a)
    print float_list

for row in unemp_lines:  #tried this way but the list returned is empty
    y = row[1].split(",")[1:-1]
    float_list = [float(i) for i in y if i]
print float_list
Run Code Online (Sandbox Code Playgroud)

python string floating-point

0
推荐指数
1
解决办法
1万
查看次数

错误是:尝试在Django中设置服务器时没有名为sqlite3.db.base的模块

您好,感谢您的帮助.我刚刚开始学习Python和Django,并且一直在尝试在djangoproject.com中设置教程.我一直在尝试设置服务器,但不断收到此错误:

Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x108826090>>
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/django/core/management/commands/runserver.py", line 91, in inner_run
self.validate(display_num_errors=True)
File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 266, in validate
num_errors = get_validation_errors(s, app)
File "/Library/Python/2.7/site-packages/django/core/management/validation.py", line 23, in get_validation_errors
from django.db import models, connection
File "/Library/Python/2.7/site-packages/django/db/__init__.py", line 40, in <module>
backend = load_backend(connection.settings_dict['ENGINE'])
File "/Library/Python/2.7/site-packages/django/db/__init__.py", line 34, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/Library/Python/2.7/site-packages/django/db/utils.py", line 92, in __getitem__
backend = load_backend(db['ENGINE'])
File "/Library/Python/2.7/site-packages/django/db/utils.py", line 44, in …
Run Code Online (Sandbox Code Playgroud)

python django

0
推荐指数
1
解决办法
3174
查看次数

无法SSH入AWS权限被拒绝(publickey)

试图部署我的第一个Web应用程序,并且难以通过SSH进入AWS.当我进入:

ssh -v -i ec2-myportfolio.pem root@ec2-23-23-165-24.compute-1.amazonaws.com
Run Code Online (Sandbox Code Playgroud)

我得到Permission denied(公钥).我在堆栈上看了几个其他的响应,就像 这样这个,但是没有解决问题.以下是我得到的错误.在此先感谢您的帮助.

OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011
Warning: Identity file ec2-myportfolio.pem not accessible: No such file or directory.
debug1: Reading configuration data /etc/ssh_config
debug1: Applying options for *
debug1: Connecting to ec2-23-23-165-24.compute-1.amazonaws.com [23.23.165.24] port 22.
debug1: Connection established.
debug1: identity file /Users/jonathanschen/.ssh/id_rsa type 1
debug1: identity file /Users/jonathanschen/.ssh/id_rsa-cert type -1
debug1: identity file /Users/jonathanschen/.ssh/id_dsa type -1
debug1: identity file /Users/jonathanschen/.ssh/id_dsa-cert type -1
debug1: Remote protocol version 2.0, remote software …
Run Code Online (Sandbox Code Playgroud)

ssh amazon-ec2

0
推荐指数
1
解决办法
2071
查看次数

标签 统计

python ×3

django ×2

amazon-ec2 ×1

floating-point ×1

heroku ×1

ssh ×1

string ×1