Django: «редакция» не является зарегистрированным пространством имен - PullRequest
0 голосов
/ 20 июня 2019

Я получаю сообщение об ошибке 'editorial' is not a registered namespace

Страница Github моего проекта:

https://github.com/OmarGonD/el-comercio-editoriales

Я нашелэтот похожий вопрос:

Django - не зарегистрированное пространство имен

Но в настоящее время я использую его решение (использовать пространство имен в файле URL проекта) и до сих порполучение ошибки.

Proyect urls.py:

"""el_comercio_app URL Configuration"""

from django.contrib import admin
from django.urls import path, include

urlpatterns = [
     path("", include("editorial.urls", namespace='editorial')),
]

редакция urls.py:

from django.urls import path
from editorial import views
from django.contrib import admin

app_name = 'editorial'

urlpatterns = [
    path('admin', admin.site.urls),
    path("", views.today_editorial, name="today_editorial")
]

Ошибка возникает при запуске теста:

cover run manage.py test editorial -v 2

# models test
class EditorialTest(TestCase):

    def create_editorial(self, title="only a test", body="yes, this is only a test"):
        return Editorial.objects.create(title=title, body=body,
               url="https://www.google.com", image = "https://img.elcomercio.pe/files/article_content_ec_fotos/uploads/2019/06/19/5d0ae893b3287.jpeg",
               date=timezone.now())

    def test_today_editorial_view(self):
        url = reverse("editorial:today_editorial")
        resp = self.client.get(url)

        self.assertEqual(resp.status_code, 200)   
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...