我已经看过这个问题的其他答案,但是我仍然不知道出了什么问题。 确实,我的项目可以在Ubuntu和Fedora上运行,但是我必须在Debian上部署脚本,这就是我收到错误消息的地方
>Exception in thread django-main-thread:
>Traceback (most recent call last):
> File "/var/rails/venv/lib/python3.5/site-packages/django/urls/resolvers.py", line 581, in url_patterns
> iter(patterns)
>TypeError: 'module' object is not iterable
>
>During handling of the above exception, another exception occurred:
>
>Traceback (most recent call last):
> File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
> self.run()
> File "/usr/lib/python3.5/threading.py", line 862, in run
> self._target(*self._args, **self._kwargs)
> File "/var/rails/venv/lib/python3.5/site-packages/django/utils/autoreload.py", line 54, in wrapper
> fn(*args, **kwargs)
> File "/var/rails/venv/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run
> self.check(display_num_errors=True)
> File "/var/rails/venv/lib/python3.5/site-packages/django/core/management/base.py", line 390, in check
> include_deployment_checks=include_deployment_checks,
> File "/var/rails/venv/lib/python3.5/site-packages/django/core/management/base.py", line 377, in _run_checks
> return checks.run_checks(**kwargs)
> File "/var/rails/venv/lib/python3.5/site-packages/django/core/checks/registry.py", line 72, in run_checks
> new_errors = check(app_configs=app_configs)
> File "/var/rails/venv/lib/python3.5/site-packages/django/core/checks/urls.py", line 13, in check_url_config
> return check_resolver(resolver)
> File "/var/rails/venv/lib/python3.5/site-packages/django/core/checks/urls.py", line 23, in check_resolver
> return check_method()
> File "/var/rails/venv/lib/python3.5/site-packages/django/urls/resolvers.py", line 398, in check
> for pattern in self.url_patterns:
> File "/var/rails/venv/lib/python3.5/site-packages/django/utils/functional.py", line 80, in __get__
> res = instance.__dict__[self.name] = self.func(instance)
> File "/var/rails/venv/lib/python3.5/site-packages/django/urls/resolvers.py", line 588, in url_patterns
> raise ImproperlyConfigured(msg.format(name=self.urlconf_name))
>django.core.exceptions.ImproperlyConfigured: The included URLconf 'compare.urls' does not appear to have any patterns in it. If you see valid patterns in the file then the issue is probably caused by a circular import.
我的compare.urls
"""compare URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('', include("comparison.urls")),
path('comparison/', include('comparison.urls')),
path('admin/', admin.site.urls),
]
和我的comparison.urls(应用)
from django.urls import path
from . import views
urlpatterns = [
path('comparison/', views.viewResults ,name='results'),
path('',views.home, name = "home"),
]
在评论之后,我添加
观看次数:
from django.shortcuts import render
from comparison.models import *
import test4
# Create your views here.
def viewResults(request):
test4.main()
listImport = []
listExport = []
listCompare = []
listSave = []
listExportFP = []
listFile = []
listFolder = test4.listU
path_name = test4.path_name
for i in range(len(ImportError.objects.all())):
a = ImportError.objects.all()[i].fileError
b = ImportError.objects.all()[i].value
c = ImportError.objects.all()[i].dateError
d = ImportError.objects.all()[i].durationError
listImport.append([a,b,c,d,listFolder[i]])
for i in range(len(CompareError.objects.all())):
e = CompareError.objects.all()[i].fileError
f = CompareError.objects.all()[i].value
g = CompareError.objects.all()[i].dateError
h = CompareError.objects.all()[i].durationError
listCompare.append([e,f,g,h])
for i in range(len(ExportError.objects.all())):
j = ExportError.objects.all()[i].fileError
k = ExportError.objects.all()[i].value
l = ExportError.objects.all()[i].dateError
m = ExportError.objects.all()[i].durationError
listExport.append([j,k,l,m])
for i in range(len(ExportFerosPdsError.objects.all())):
n = ExportFerosPdsError.objects.all()[i].fileError
o = ExportFerosPdsError.objects.all()[i].value
p = ExportFerosPdsError.objects.all()[i].dateError
q = ExportFerosPdsError.objects.all()[i].durationError
listExportFP.append([n,o,p,q])
for i in range(len(SaveError.objects.all())):
r = SaveError.objects.all()[i].fileError
s = SaveError.objects.all()[i].value
t = SaveError.objects.all()[i].dateError
u = SaveError.objects.all()[i].durationError
listSave.append([r,s,t,u])
listImport = sorted(listImport)
listSave = sorted(listSave)
listCompare = sorted(listCompare)
listExport = sorted(listExport)
listExportFP = sorted(listExportFP)
for i in range(len(ImportError.objects.all())):
listFile.append([listImport[i],listCompare[i],listExport[i],listExportFP[i],listSave[i]])
return render(request, 'comparison/results.html', locals())
def home(request):
return render(request, 'comparison/home.html', locals())
这是我的test4的导入
import os
import openpyxl as op
import random as rd
import shutil as sh
import datetime as dt
import shutil as sh
from openpyxl.utils import get_column_letter
from openpyxl.styles import PatternFill
from openpyxl.styles import colors
from openpyxl.styles import Font, Color
import pyexcel as p
import time
import sys
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import ElementClickInterceptedException
import pyautogui
from comparison.models import *
当我评论“ import pyautogui”脚本时,它似乎可以工作。 但是我需要这个库。
感谢帮助我