小编Dmi*_*try的帖子

姜戈。ImportError:尝试相对导入超出顶级包

我是新手。我刚刚开始写一个 django 项目。它称为 iRayProject,由两个应用程序 iRay_user_authentication 和 iRay_working_with_notes 组成: 此处的项目结构

iRay_user_authentication - 这是一个用于注册的标准 django 应用程序

这是他的 urls.py

from django.urls import path
from .views import login_user, registration

urlpatterns = [
    path('', login_user, name='login_user'),
    path('registration', registration, name='registration'),
]
Run Code Online (Sandbox Code Playgroud)

在views.py中使用重定向注册用户我想发送到项目的第二个应用程序

from django.shortcuts import render, redirect
from django.contrib.auth.forms import UserCreationForm, AuthenticationForm
from django.contrib.auth.models import User
from django.db import IntegrityError
from django.contrib.auth import login, logout, authenticate
from ..iRay_working_with_notes.views import list_notes


def login_user(request):
    if request.method == 'GET':
        return render(request, 'iRay_user_authentication/login.html', {'form': AuthenticationForm})


def registration(request):
    if request.method == …
Run Code Online (Sandbox Code Playgroud)

python django structure path project

4
推荐指数
1
解决办法
6817
查看次数

标签 统计

django ×1

path ×1

project ×1

python ×1

structure ×1