manage.py runserver 0.0.0.0:8000 ImportError没有名为DBCONN的模块

时间:2017-06-01 16:58:59

标签: python django

我正在运行manage.py runserver并为" dbconn"获取导入错误该文件存在于django项目目录中。这是我的django项目的目录列表。同样在这下面,我已经包括了我的追溯。如果有人有任何想法,我正在学习django。

-rw-rw-r--. 1 cchadwick cchadwick 1230 Jun  1 12:30 chartcall.py
-rw-rw-r--. 1 cchadwick cchadwick 1651 Jun  1 12:24 dbconn.py
-rw-rw-r--. 1 cchadwick cchadwick    0 May 26 14:43 __init__.py
drwxrwxr-x. 2 cchadwick cchadwick  240 Jun  1 12:30 __pycache__
-rw-rw-r--. 1 cchadwick cchadwick 3569 Jun  1 11:58 settings.py
-rw-rw-r--. 1 cchadwick cchadwick  959 May 30 14:10 urls.py
-rw-rw-r--. 1 cchadwick cchadwick  181 May 31 15:04 views.py
-rw-rw-r--. 1 cchadwick cchadwick  396 May 26 14:43 wsgi.py


(dbenv) [cchadwick@opendev-cutco-com dashproj1]$ python manage.py runserver 0.0.0.0:8000

Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7f4d001ce488>
Traceback (most recent call last):
File "/home/cchadwick/dbenv/lib/python3.4/site-packages/django/utils   /autoreload.py", line 227, in wrapper
fn(*args, **kwargs)
File "/home/cchadwick/dbenv/lib/python3.4/site-packages/django /core/management/commands/runserver.py", line 117, in inner_run
autoreload.raise_last_exception()
File "/home/cchadwick/dbenv/lib/python3.4/site-packages/django/utils/autoreload.py", line 250, in raise_last_exception
six.reraise(*_exception)
File "/home/cchadwick/dbenv/lib/python3.4/site-packages/django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/home/cchadwick/dbenv/lib/python3.4/site-packages/django/utils/autoreload.py", line 227, in wrapper
fn(*args, **kwargs)
File "/home/cchadwick/dbenv/lib/python3.4/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/cchadwick/dbenv/lib/python3.4/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/home/cchadwick/dbenv/lib/python3.4/site-packages/django/apps/config.py", line 94, in create
module = import_module(entry)
File "/home/cchadwick/dbenv/lib64/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2224, in _find_and_load_unlocked
ImportError: No module named 'dbconn'

以下是dbconn文件的代码。

import pyodbc

def db2conn():
    conn = pyodbc.connect(
    driver='{iSeries Access ODBC Driver}',
    system="0.0.0.0",
    uid='USER',
    pwd='PASS')

    c1 = conn.cursor()
    return c1, conn

这是chartcall.py

#import numpy as np
from bokeh.plotting import figure 
from bokeh.io import output_file, save, show
from time import sleep
from pandas import DataFrame, read_sql_query, to_numeric, options,    set_eng_float_format, formats
from geopy import Nominatim, geocoders
from geopy.exc import GeocoderTimedOut
import gmplot
import geocoder
from bokeh.models import (Range1d, PanTool, ResetTool, HoverTool,   ColumnDataSource, LabelSet,
                      GMapPlot, GMapOptions, DataRange1d, PanTool, WheelZoomTool, BoxSelectTool, Circle)
#from django.db import Connection
# import matplotlib.pyplot as plt
#from tkinter import *
#import dbconn 



c1, conn = db2conn()


def orders_by_day():
    sql = """ Select count(doord#) total_ords, sum(dolin1) total_lin1   from dmfiles.dmordm0 
              join dmfiles.bncchan0 on dootyp = ordertype 
              and doomtd = ordermethod 
              where 
              doocat = 'ORD' and doco# = '00004' and channel = 'Catalog'
              and doshpd between current_date - 1 days and current_date

             """

     x = []

     y = []
     i = 0
     c1.execute(sql)
     for row in c1.execute(sql):
        x.append(row[0])
        y.append(row[1])

     return x, y

0 个答案:

没有答案