python
<views.py>
from django.shortcuts import render
import requests, json
from requests_html import HTMLSession
from blog.models import Mydjangodb
session = HTMLSession()
def index(request):
template_name = "blog/index.html"
context = {}
if request.method == "GET":
key_word = request.GET['title']
context = {
'title': 'GET',
}
省略
で
ModuleNotFoundError: No module named 'blog'のエラーが出ます。
これを直したいのですが、どうしたら良いでしょうか?
ちなみに
python
<models.py>
from django.db import models
class AuthGroup(models.Model):
name = models.CharField(unique=True, max_length=150)
class Meta: managed = False db_table = 'auth_group'
class AuthGroupPermissions(models.Model):
group = models.ForeignKey(AuthGroup, models.DO_NOTHING)
permission = models.ForeignKey('AuthPermission', models.DO_NOTHING)
class Meta: managed = False db_table = 'auth_group_permissions' unique_together = (('group', 'permission'),)
class AuthPermission(models.Model):
name = models.CharField(max_length=255)
content_type = models.ForeignKey('DjangoContentType', models.DO_NOTHING)
codename = models.CharField(max_length=100)
class Meta: managed = False db_table = 'auth_permission' unique_together = (('content_type', 'codename'),)
class AuthUser(models.Model):
password = models.CharField(max_length=128)
last_login = models.DateTimeField(blank=True, null=True)
is_superuser = models.IntegerField()
username = models.CharField(unique=True, max_length=150)
first_name = models.CharField(max_length=150)
last_name = models.CharField(max_length=150)
email = models.CharField(max_length=254)
is_staff = models.IntegerField()
is_active = models.IntegerField()
date_joined = models.DateTimeField()
class Meta: managed = False db_table = 'auth_user'
class AuthUserGroups(models.Model):
user = models.ForeignKey(AuthUser, models.DO_NOTHING)
group = models.ForeignKey(AuthGroup, models.DO_NOTHING)
class Meta: managed = False db_table = 'auth_user_groups' unique_together = (('user', 'group'),)
※省略※
class Mydjangodb(models.Model):
keywords = models.CharField(max_length=255, blank=True, null=True)
url = models.TextField(blank=True, null=True)
title = models.CharField(max_length=255, blank=True, null=True)
keywords = models.CharField(max_length=255, blank=True, null=True)
title = models.CharField(max_length=255, blank=True, null=True)
description = models.TextField(blank=True, null=True)
class Meta: managed = False db_table = 'mydjangodb'
となっています。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/12/13 12:42