Browse Source

switched over to sqlite db

fixed static files handling (wip)
fixed redirect to /blog
master
Otto Naderer 4 years ago
parent
commit
427fae7864
  1. 39
      blogapp/migrations/0002_auto_20170529_2023.py
  2. BIN
      db.sqlite3
  3. BIN
      fgfs-screen-001.png
  4. 26
      imageapp/migrations/0001_initial.py
  5. 2
      imageapp/models.py
  6. BIN
      media/IMG_20170305_125007.jpg
  7. 17
      polysite/settings.py
  8. 2
      polysite/urls.py
  9. 5
      polysite/views.py
  10. 2
      templates/base.html

39
blogapp/migrations/0002_auto_20170529_2023.py

@ -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'),
),
]

BIN
db.sqlite3

Binary file not shown.

BIN
fgfs-screen-001.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1018 KiB

26
imageapp/migrations/0001_initial.py

@ -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='')),
],
),
]

2
imageapp/models.py

@ -6,7 +6,7 @@ class BlogImage(models.Model):
title = models.CharField(max_length = 100)
caption = models.CharField(max_length = 300)
date = models.DateTimeField()
image = models.ImageField()
image = models.ImageField(upload_to = 'media/')
def __str__(self):
return self.title

BIN
media/IMG_20170305_125007.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

17
polysite/settings.py

@ -59,8 +59,8 @@ TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
'/home/ottona/Projekte/polysite/templates',
'/home/ottona/Projekte/polysite/blogapp/templates/blogapp',
os.path.join(BASE_DIR, 'templates'),
os.path.join(BASE_DIR, 'blogapp/templates/blogapp'),
],
'APP_DIRS': True,
'OPTIONS': {
@ -82,12 +82,8 @@ WSGI_APPLICATION = 'polysite.wsgi.application'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'djangotest',
'USER': 'pguser',
'PASSWORD': '',
'HOST': '127.0.0.1',
'PORT': '5432',
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
@ -129,7 +125,4 @@ USE_TZ = True
# https://docs.djangoproject.com/en/1.9/howto/static-files/
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static"),
'/home/ottona/Projekte/polysite/static',
]
STATIC_ROOT = os.path.join(BASE_DIR, 'static')

2
polysite/urls.py

@ -17,8 +17,10 @@ from django.conf.urls import url, include
from django.contrib import admin
from pageapp.views import aboutpage, contactpage
from blogapp.views import listall
from . import views
urlpatterns = [
url(r'^$', views.redi),
url(r'^blog/', include('blogapp.urls')),
url(r'^admin/', admin.site.urls),
url(r'^about/', aboutpage, name='about'),

5
polysite/views.py

@ -0,0 +1,5 @@
from django.shortcuts import redirect
def redi(request):
return redirect('/blog/')

2
templates/base.html

@ -1,7 +1,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
{% load staticfiles %}
{% load static %}
<link rel="stylesheet" type="text/css" href="{% static "general.css" %}" />
{% block head %}{% endblock %}
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"/>

Loading…
Cancel
Save