0

我试图pyrebase在我的views.py中导入,但出现了一个错误:线程django-main-thread中的异常:

Traceback (most recent call last):
  File "C:\Users\USER\Documents\python projects\yerekshe\lib\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):

    raise ImproperlyConfigured(msg.format(name=self.urlconf_name))
django.core.exceptions.ImproperlyConfigured: The included URLconf 'yerekshe.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.

这是我的views.py:

from django.shortcuts import render, redirect
from .forms import UserForm, UserProfileInfoForm, UpdateProfileForm
from django.contrib.auth import authenticate, login, logout
from django.http import HttpResponseRedirect, HttpResponse
from django.urls import reverse
from . import forms
import pyrebase

config = {
    'apiKey': "0",
    'authDomain': "yerekshe.firebaseapp.com",
    'databaseURL': "https://yerekshe.firebaseio.com",
    'projectId': "yerekshe",
    'storageBucket': "",
    'messagingSenderId': "0",
}

firebase = pyrebase.initialize_app(config)

auth = firebase.auth()

def home(request):
    return render(request, 'home.html')


def signIn(request):

    return render(request, 'login.html')

def postsign(request):
    email = request.POST.get('email')
    passw = request.POST.get("pass")
    try:
        user = auth.sign_in_with_email_and_password(email, passw)
    except:
        message = "invalid cerediantials"
    return render(request, "login.html", {"msg": message})
    print(user)
    return render(request, "home.html", {"e": email})

这里是 yerekshe\urls.py:

 from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
    path('admin/', admin.site.urls),
    path('account/', include('account.urls'))
]

if settings.DEBUG:
    urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
4

0 回答 0