switched over to sqlite db
fixed static files handling (wip) fixed redirect to /blog
This commit is contained in:
parent
f528ea9770
commit
427fae7864
|
@ -0,0 +1,39 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.11 on 2017-05-29 20:23
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('blogapp', '0001_initial'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='blogcategory',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('name', models.CharField(max_length=100)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='blogentry',
|
||||||
|
name='published',
|
||||||
|
field=models.BooleanField(default=False),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='blogcomment',
|
||||||
|
name='user',
|
||||||
|
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='blogentry',
|
||||||
|
name='categories',
|
||||||
|
field=models.ManyToManyField(to='blogapp.blogcategory'),
|
||||||
|
),
|
||||||
|
]
|
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 1018 KiB |
|
@ -0,0 +1,26 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.11 on 2017-05-29 20:23
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='BlogImage',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('title', models.CharField(max_length=100)),
|
||||||
|
('caption', models.CharField(max_length=300)),
|
||||||
|
('date', models.DateTimeField()),
|
||||||
|
('image', models.ImageField(upload_to='')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
|
@ -6,7 +6,7 @@ class BlogImage(models.Model):
|
||||||
title = models.CharField(max_length = 100)
|
title = models.CharField(max_length = 100)
|
||||||
caption = models.CharField(max_length = 300)
|
caption = models.CharField(max_length = 300)
|
||||||
date = models.DateTimeField()
|
date = models.DateTimeField()
|
||||||
image = models.ImageField()
|
image = models.ImageField(upload_to = 'media/')
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.title
|
return self.title
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.6 MiB |
|
@ -59,8 +59,8 @@ TEMPLATES = [
|
||||||
{
|
{
|
||||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
'DIRS': [
|
'DIRS': [
|
||||||
'/home/ottona/Projekte/polysite/templates',
|
os.path.join(BASE_DIR, 'templates'),
|
||||||
'/home/ottona/Projekte/polysite/blogapp/templates/blogapp',
|
os.path.join(BASE_DIR, 'blogapp/templates/blogapp'),
|
||||||
],
|
],
|
||||||
'APP_DIRS': True,
|
'APP_DIRS': True,
|
||||||
'OPTIONS': {
|
'OPTIONS': {
|
||||||
|
@ -82,12 +82,8 @@ WSGI_APPLICATION = 'polysite.wsgi.application'
|
||||||
|
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': 'django.db.backends.postgresql',
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
'NAME': 'djangotest',
|
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
||||||
'USER': 'pguser',
|
|
||||||
'PASSWORD': '',
|
|
||||||
'HOST': '127.0.0.1',
|
|
||||||
'PORT': '5432',
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +125,4 @@ USE_TZ = True
|
||||||
# https://docs.djangoproject.com/en/1.9/howto/static-files/
|
# https://docs.djangoproject.com/en/1.9/howto/static-files/
|
||||||
|
|
||||||
STATIC_URL = '/static/'
|
STATIC_URL = '/static/'
|
||||||
STATICFILES_DIRS = [
|
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
|
||||||
os.path.join(BASE_DIR, "static"),
|
|
||||||
'/home/ottona/Projekte/polysite/static',
|
|
||||||
]
|
|
||||||
|
|
|
@ -17,8 +17,10 @@ from django.conf.urls import url, include
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from pageapp.views import aboutpage, contactpage
|
from pageapp.views import aboutpage, contactpage
|
||||||
from blogapp.views import listall
|
from blogapp.views import listall
|
||||||
|
from . import views
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
url(r'^$', views.redi),
|
||||||
url(r'^blog/', include('blogapp.urls')),
|
url(r'^blog/', include('blogapp.urls')),
|
||||||
url(r'^admin/', admin.site.urls),
|
url(r'^admin/', admin.site.urls),
|
||||||
url(r'^about/', aboutpage, name='about'),
|
url(r'^about/', aboutpage, name='about'),
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
from django.shortcuts import redirect
|
||||||
|
|
||||||
|
def redi(request):
|
||||||
|
return redirect('/blog/')
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
{% load staticfiles %}
|
{% load static %}
|
||||||
<link rel="stylesheet" type="text/css" href="{% static "general.css" %}" />
|
<link rel="stylesheet" type="text/css" href="{% static "general.css" %}" />
|
||||||
{% block head %}{% endblock %}
|
{% block head %}{% endblock %}
|
||||||
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"/>
|
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"/>
|
||||||
|
|
Loading…
Reference in New Issue