Commit f7b04b05 authored by Vasyl Bodnaruk's avatar Vasyl Bodnaruk Committed by Andrii Marynets

make web app

parent 395b8217
......@@ -56,7 +56,7 @@ ROOT_URLCONF = 'esi.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
......
......@@ -13,9 +13,10 @@ Including another URLconf
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url
from django.conf.urls import url, include
from django.contrib import admin
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'news/', include('webapp.urls'))
]
from django.contrib import admin
# Register your models here.
from django.apps import AppConfig
class MainConfig(AppConfig):
name = 'main'
from django.db import models
# Create your models here.
from django.test import TestCase
# Create your tests here.
from django.conf.urls import url
from .views import MainView
urlpatterns = [
url(r'', MainView.as_view(), name='index')
]
\ No newline at end of file
from django.shortcuts import render
from django.views.generic import TemplateView
class MainView(TemplateView):
template_name = 'index.html'
def get(self, request, *args, **kwargs):
pass
from django.conf.urls import url
from .views import ListNewsView, DetailNewsView
urlpatterns = [
url(r'^$', ListNewsView.as_view(), name='list_news'),
url(r'(?P<id>[0-9]+)$', DetailNewsView.as_view(), name='single_news')
]
\ No newline at end of file
from django.shortcuts import render
from django.views.generic import ListView, DetailView
# Create your views here.
from .models import News, WpEsiNews, WpEsiNewsEntity
class ListNewsView(ListView):
template_name = 'list_news.html'
model = News
def get(self, request, *args, **kwargs):
news = News.objects.all().order_by('id')
return render(request, self.template_name, {'news': news})
class DetailNewsView(DetailView):
template_name = 'single_news.html'
model = News
def get(self, request, *args, **kwargs):
pass
\ No newline at end of file
......@@ -43,7 +43,6 @@ class SeleniumDownloadMiddleware(object):
try:
self.driver.get(request.url)
except BaseException as e:
print('Exception in process loading page')
return None
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment