Answer the question
In order to leave comments, you need to log in
When trying to make migrations, errors are displayed, what should I do?
setting.py
INSTALLED_APPS = [
'articles.apps.ArticlesConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
from django.db import models
import django
django.setup()
class Article(models.Model):
article_title = models.CharField('Название статьи', max_Length = 200)
article_text = models.TextField('Текст статьи')
pub_date = models.DateTimeField('Дата публикации')
class Comment(models.Model):
article = models.ForeingKey(Article, on_delete = models.CASCADE)
author_name = models.CharField('Автор комментария', max_Length = 50)
comment_text = models.CharField('Комментарий', max_Length = 150)
from django.http import HttpResponse
def index(request):
return HttpResponse("test")
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name = 'index'),
]
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('articles/', include('articles.urls')),
path('admin/', admin.site.urls)
]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question