Initial commit

This commit is contained in:
Gergely Polonkai 2013-09-24 15:54:41 +02:00
commit c544d768ef
32 changed files with 706 additions and 0 deletions

0
blog/__init__.py Normal file
View File

4
blog/admin.py Normal file
View File

@ -0,0 +1,4 @@
from django.contrib import admin
from blog.models import Post
admin.site.register(Post)

13
blog/models.py Normal file
View File

@ -0,0 +1,13 @@
from django.db import models
from django.contrib.auth.models import User
class Post(models.Model):
user = models.ForeignKey(User)
created_at = models.DateTimeField()
title = models.CharField(max_length = 100)
slug = models.CharField(max_length = 100)
content = models.TextField()
draft = models.BooleanField()
def __unicode__(self):
return self.title

19
blog/static/css/admin.css Normal file
View File

@ -0,0 +1,19 @@
/*
Document : admin.css
Created on : 2012.09.05., 15:49:05
Author : polonkai.gergely
Description:
Purpose of the stylesheet follows.
*/
ul.menu {
padding: .5em;
list-style-type: none;
margin: 0 0 1em 0;
border-bottom: 1px solid black;
}
ul.menu li {
display: inline;
margin-right: 1em;
}

26
blog/static/css/blog.css Normal file
View File

@ -0,0 +1,26 @@
/*
Document : blog
Created on : 2012.09.14., 14:53:34
Author : polonkai.gergely
Description:
Purpose of the stylesheet follows.
*/
.post {
margin-bottom: 2em;
}
p.article-date {
text-indent: 0;
font-size: 80%;
color: #7f7f7f;
}
.paginator {
margin: .5em 0;
}
.plusone-container {
margin-left: 1em;
display: inline;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,11 @@
{% extends "front_base.html" %}
{% block content %}
{% if posts %}
{% for post in posts %}
{{ post.title }}
{% endfor %}
{% else %}
<p>No posts are returned for your query.</p>
{% endif %}
{% endblock %}

View File

@ -0,0 +1,5 @@
{% extends "front_base.html" %}
<div class="post">
<h3><a href="{% url 'read' post.created_at.year post.created_at.month post.created_at.day post.slug %}">{{ post.title }}</a></h3>
</div>

16
blog/tests.py Normal file
View File

@ -0,0 +1,16 @@
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 always equals 2.
"""
self.assertEqual(1 + 1, 2)

11
blog/urls.py Normal file
View File

@ -0,0 +1,11 @@
from django.conf.urls import patterns, url
from blog import views
urlpatterns = patterns('',
url(r'^$', views.index, name='index'),
url(r'^feed$', views.feed, name='feed'),
url(r'^(?P<year>\d+)/(?P<month>\d+)/(?P<day>\d+)/(?P<slug>[^/]+)$', views.read, name='read'),
url(r'^resume', views.resume, name='resume'),
url(r'^about', views.resume, name='about'),
url(r'^disclaimer', views.resume, name='disclaimer'),
)

24
blog/views.py Normal file
View File

@ -0,0 +1,24 @@
import datetime
from django.shortcuts import render, get_object_or_404
from blog.models import Post
def index(request):
last_posts = Post.objects.order_by('-created_at')[:5]
context = { 'posts': last_posts }
return render(request, 'blog/listing.html', context)
def read(request, year, month, day, slug):
post = get_object_or_404(Post, created_at__year=int(year), created_at__month=int(month), created_at__day=int(day), slug=slug);
return render(request, 'blog/view.html', {'post': post})
def feed(request):
return render(request, 'blog/feed.xml', {})
def resume(request):
return render(request, 'resume.html', {})
def about(request):
return renden(request, 'about.html', {})
def disclaimer(request):
return renden(request, 'disclaimer.html', {})

View File

View File

@ -0,0 +1,162 @@
import os, os.path
# Django settings for gergelypolonkai_django project.
SITE_ROOT = os.path.dirname(os.path.realpath(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'gergelypolonkai', # Or path to database file if using sqlite3.
# The following settings are not used with sqlite3:
'USER': 'gergelypolonkai',
'PASSWORD': 'the8dooM',
'HOST': '', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
'PORT': '', # Set to empty string for default.
}
}
# Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
ALLOWED_HOSTS = []
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# In a Windows environment this must be set to your system time zone.
TIME_ZONE = 'Europe/Budapest'
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-gb'
SITE_ID = 1
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True
# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/var/www/example.com/media/"
MEDIA_ROOT = ''
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://example.com/media/", "http://media.example.com/"
MEDIA_URL = ''
# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/var/www/example.com/static/"
STATIC_ROOT = ''
# URL prefix for static files.
# Example: "http://example.com/static/", "http://static.example.com/"
STATIC_URL = '/static/'
# Additional locations of static files
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
SITE_ROOT + os.path.sep + "static",
)
# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
# Make this unique, and don't share it with anybody.
SECRET_KEY = 'ol#oly77qotgh%47ylflf3wwtr^(b5@=nhd8&@9=!q@*r34w#l'
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
# Uncomment the next line for simple clickjacking protection:
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
ROOT_URLCONF = 'gergelypolonkai_django.urls'
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'gergelypolonkai_django.wsgi.application'
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
SITE_ROOT + os.path.sep + "templates"
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'compressor',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
'blog',
)
# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error when DEBUG=False.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -0,0 +1,244 @@
* {
font-family: sans-serif;
}
body {
background-color: #333333;
margin: 0;
}
#content-wrapper {
background-color: #ffffff;
width: 960px;
margin-left: auto;
margin-right: auto;
padding-top: 14px;
}
#header {
height: 120px;
background-color: #4d4d4d;
color: #ffffff;
position: absolute;
width: 960px;
height: 190px;
}
#header #picture {
background-color: white;
position: relative;
width: 170px;
height: 170px;
display: inline;
float: left;
top: 40px;
left: 20px;
}
#header #picture img {
margin: 10px;
}
#header h1 {
text-align: right;
margin: 40px 10px 0 0;
font-size: 41px;
font-weight: bold;
padding-top: 45px;
}
#header h1 a {
color: #ffffff;
text-decoration: none;
}
#header h2 {
text-align: right;
margin: 0 10px 0 0;
font-size: 12px;
font-weight: normal;
padding-top: 5px;
}
#contact-list {
position: absolute;
right: -22px;
width: 20px;
}
#contact-list a {
display: block;
}
#menu {
background-color: #f18137;
height: 39px;
margin-top: 15px;
}
#tagcloud-button {
float: left;
padding-top: 2px;
padding-left: 6px;
cursor: pointer;
}
#menu ul {
margin: 8px;
padding: 0;
list-style-type: none;
float: right;
}
#menu ul li {
float: right;
margin-top: 1px;
margin-bottom: 10px;
margin-left: 1em;
height: 30px;
}
#menu ul li.active {
background-image: url('../images/arrow-up.png');
background-repeat: no-repeat;
background-position: center bottom;
}
#menu ul li a {
color: white;
font-weight: bold;
text-decoration: none;
font-size: 12px;
}
#content {
clear: both;
padding: 8px;
}
#content-padding {
height: 200px;
}
#content h3 {
margin: .5em 0 .2em 0;
}
#content p {
margin: .6em 0;
text-indent: 1.5em;
text-align: justify;
font-size: 80%;
}
#content a {
color: black;
text-decoration: underline;
}
dt {
font-weight: normal;
text-decoration: underline;
}
dd p {
text-indent: 0 !important;
margin-top: .5em !important;
}
#page-disclaimer {
margin-top: 2em;
text-align: right;
font-size: 80%;
color: #7f7f7f;
}
#page-disclaimer a {
color: #7f7f7f;
text-decoration: underline;
}
#bottombar-wrapper {
display: block;
}
#bottombar-padding {
clear: both;
height: 35px;
}
#bottombar {
position: fixed;
background-color: #4d4d4d;
bottom: 0;
left: 0;
margin: 0;
z-index: 70000;
width: 100%;
padding: 1em;
text-align: center;
vertical-align: center;
color: #b3b3b3;
font-size: 10px;
border-top: 1px solid black;
}
#bottombar a {
color: #b3b3b3;
text-decoration: underline;
}
#more-posts {
margin-top: 1em;
text-align: right;
}
#tag-cloud {
position: absolute;
width: 600px;
padding: 8px;
border: 1px solid black;
background-color: #303030;
margin-left: 5px;
margin-top: 2px;
display: none;
}
#tag-cloud a {
color: #b3b3b3;
text-decoration: none;
padding: 8px;
}
#tag-cloud .size0 {
font-size: 80%;
}
#tag-cloud .size1 {
font-size: 90%;
}
#tag-cloud .size2 {
font-size: 100%;
}
#tag-cloud .size3 {
font-size: 110%;
}
#tag-cloud .size4 {
font-size: 130%;
}
#tag-cloud .size5 {
font-size: 150%;
}
.clear {
clear: both;
}
pre {
font-family: monospace;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 660 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 608 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 502 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 529 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 867 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 714 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 711 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 801 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 748 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 805 B

View File

@ -0,0 +1,113 @@
{% load static from staticfiles %}
{% load compress %}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Gergely Polonkai{% block title %}{% endblock %}</title>
<link rel="icon" type="image/x-icon" href="{% static "favicon.ico" %}" />
{% compress css %}
{% block css %}
<link rel="stylesheet" type="text/css" href="{% static "css/front.css" %}" media="screen" />
<link rel="stylesheet" type="text/css" href="{% static "css/blog.css" %}" media="screen" />
{% endblock %}
{% endcompress %}
<link rel="alternate" type="application/rss+xml" title="Gergely Polonkai's Blog - RSS Feed" href="{{ app.request.scheme }}://{{ app.request.host }}{% url 'blog:feed' %}" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
</head>
<body>
<div id="content-wrapper">
<div id="header" style="background-image: url('{% static "images/random_header.jpg" %}');">
<div id="picture">
<img src="{% static "images/profile.png" %}" alt="" />
</div>
<h1><a href="{% url 'home' %}">Gergely Polonkai</a></h1>
<h2>developer, systems engineer and administrator</h2>
<div id="contact-list">
<a href="mailto:gergely@polonkai.eu" target="_blank"><img src="{% static "images/email_16.png" %}" alt="E-mail" /></a>
<a href="http://www.linkedin.com/in/gergelypolonkai" target="_blank"><img src="{% static "images/linkedin_16.png" %}" alt="LinkedIn profile" /></a>
<a href="skype:w00dhun" target="_blank"><img src="{% static "images/skype_16.png" %}" alt="Skype" /></a>
<a href="http://facebook.com/Polesz" target="_blank"><img src="{% static "images/facebook_16.png" %}" alt="Facebook profile" /></a>
<a href="https://plus.google.com/u/1/105740970718293884702/about" target="_blank"><img src="{% static "images/google_plus_16.png" %}" alt="Google+ profile" /></a>
<a href="gtalk:chat?jid=gergely@polonkai.eu" target="_blank"><img src="{% static "images/googletalk_16.png" %}" alt="Google Talk" /></a>
<a href="http://twitter.com/W00d5t0ck" target="_blank"><img src="{% static "images/twitter_16.png" %}" alt="Twitter" /></a>
<a href="http://tumblr.w00d5t0ck.info" target="_blank"><img src="{% static "images/tumblr_16.png" %}" alt="Tumblr" /></a>
<a href="msnim:chat?contact=polesz@w00d5t0ck.info" target="_blank"><img src="{% static "images/windows_16.png" %}" alt="Windows Live" /></a>
<a href="http://w00d5t0ck.deviantart.com" target="_blank"><img src="{% static "images/deviantart_16.png" %}" alt="deviantArt" /></a>
<a href="{% url 'blog:feed' %}"><img src="{% static "images/rss_16.png" %}" alt="RSS Feed" /></a>
</div>
</div>
<div id="content-padding"></div>
<div id="menu">
<div id="tagcloud-button"><img alt="" src="{% static "images/tagcloud.png" %}" /></div>
<ul>
<li {% if currentMenu == 'resume' %} class="active"{% endif %}><a href="{% url 'blog:resume' %}">Resume</a></li>
<li {% if currentMenu == 'blog' %} class="active"{% endif %}><a href="{% url 'blog:index' %}">Blog</a></li>
<li {% if currentMenu == 'about' %} class="active"{% endif %}><a href="{% url 'blog:about' %}">About me</a></li>
</ul>
<br class="clear" />
</div>
{% if tagCloud|length > 0 %}
<div id="tag-cloud">
{% for cloudItem in tagCloud %}
<a href="{% url 'blog_tag_list' cloudItem.name %}" class="size{{ cloudItem.size }}">{{ cloudItem.name }}</a>{% if not loop.last %} | {% endif %}
{% endfor %}
</div>
{% endif %}
<div id="content">
{% block content %}{% endblock content %}
</div>
</div>
<div id="bottombar-wrapper">
<div id="bottombar-padding"></div>
<div id="bottombar"{% if app.environment == 'dev' %} style="bottom: 40px;"{% endif %}>
:: Copyright &copy; 2012, Gergely Polonkai :: <a href="{% url 'blog:disclaimer' %}">Disclaimer</a> ::
</div>
</div>
<a href="https://github.com/gergelypolonkai" id="github-ribbon" target="_blank"><img style="position: absolute; top: 0; left: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_left_orange_ff7600.png" alt="Fork me on GitHub"></a>
<iframe src="http://githubbadge.appspot.com/badge/gergelypolonkai?s=1&a=0" style="border: 0; height: 142px; width: 200px; overflow: hidden; display: none; position: absolute; top: 100px; left: 100px;" frameBorder="0" id="github-badge"></iframe>
<script type="text/javascript">
$(document).ready(function() {
$('.at-obfuscation').html('@');
$('#tagcloud-button').click(function() {
$('#tag-cloud').toggle('slow');
});
$('#github-ribbon').mouseover(function() {
$('#github-badge').fadeIn();
});
$('#github-ribbon').mouseout(function() {
$('#github-badge').fadeOut();
});
$(document).mousemove(function(e) {
$('#github-badge').css({
top: e.pageY + 5,
left: e.pageX + 5
});
});
});
(function() {
var po = document.createElement('script');
po.type = 'text/javascript';
po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(po, s);
})();
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-43569023-1', 'polonkai.eu');
ga('send', 'pageview');
</script>
</body>
</html>

View File

@ -0,0 +1,16 @@
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
url(r'^$', 'blog.views.index', name='home'),
# url(r'^$', 'gergelypolonkai_django.views.home', name='home'),
url(r'^blog/', include('blog.urls', namespace='blog')),
# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^admin/', include(admin.site.urls)),
)

View File

@ -0,0 +1,32 @@
"""
WSGI config for gergelypolonkai_django project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` setting.
Usually you will have the standard Django WSGI application here, but it also
might make sense to replace the whole Django WSGI application with a custom one
that later delegates to the Django one. For example, you could introduce WSGI
middleware here, or combine a Django application with an application of another
framework.
"""
import os
# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks
# if running multiple sites in the same mod_wsgi process. To fix this, use
# mod_wsgi daemon mode with each site in its own daemon process, or use
# os.environ["DJANGO_SETTINGS_MODULE"] = "gergelypolonkai_django.settings"
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "gergelypolonkai_django.settings")
# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
# setting points here.
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
# Apply WSGI middleware here.
# from helloworld.wsgi import HelloWorldApplication
# application = HelloWorldApplication(application)

10
manage.py Normal file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "gergelypolonkai_django.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)