commit c544d768ef3df7af67b420b876cf5f6fedea0789 Author: Gergely Polonkai Date: Tue Sep 24 15:54:41 2013 +0200 Initial commit diff --git a/blog/__init__.py b/blog/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/blog/admin.py b/blog/admin.py new file mode 100644 index 0000000..5868050 --- /dev/null +++ b/blog/admin.py @@ -0,0 +1,4 @@ +from django.contrib import admin +from blog.models import Post + +admin.site.register(Post) diff --git a/blog/models.py b/blog/models.py new file mode 100644 index 0000000..5ccee54 --- /dev/null +++ b/blog/models.py @@ -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 diff --git a/blog/static/css/admin.css b/blog/static/css/admin.css new file mode 100644 index 0000000..0d82813 --- /dev/null +++ b/blog/static/css/admin.css @@ -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; +} \ No newline at end of file diff --git a/blog/static/css/blog.css b/blog/static/css/blog.css new file mode 100644 index 0000000..b9778cd --- /dev/null +++ b/blog/static/css/blog.css @@ -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; +} \ No newline at end of file diff --git a/blog/static/images/tagcloud.png b/blog/static/images/tagcloud.png new file mode 100644 index 0000000..a58e4e9 Binary files /dev/null and b/blog/static/images/tagcloud.png differ diff --git a/blog/templates/blog/listing.html b/blog/templates/blog/listing.html new file mode 100644 index 0000000..50c792e --- /dev/null +++ b/blog/templates/blog/listing.html @@ -0,0 +1,11 @@ +{% extends "front_base.html" %} + +{% block content %} +{% if posts %} +{% for post in posts %} +{{ post.title }} +{% endfor %} +{% else %} +

No posts are returned for your query.

+{% endif %} +{% endblock %} diff --git a/blog/templates/blog/view.html b/blog/templates/blog/view.html new file mode 100644 index 0000000..6af6be7 --- /dev/null +++ b/blog/templates/blog/view.html @@ -0,0 +1,5 @@ +{% extends "front_base.html" %} + +
+

{{ post.title }}

+
diff --git a/blog/tests.py b/blog/tests.py new file mode 100644 index 0000000..501deb7 --- /dev/null +++ b/blog/tests.py @@ -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) diff --git a/blog/urls.py b/blog/urls.py new file mode 100644 index 0000000..55701a1 --- /dev/null +++ b/blog/urls.py @@ -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\d+)/(?P\d+)/(?P\d+)/(?P[^/]+)$', 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'), +) diff --git a/blog/views.py b/blog/views.py new file mode 100644 index 0000000..790c2cb --- /dev/null +++ b/blog/views.py @@ -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', {}) diff --git a/gergelypolonkai_django/__init__.py b/gergelypolonkai_django/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/gergelypolonkai_django/settings.py b/gergelypolonkai_django/settings.py new file mode 100644 index 0000000..1e668a8 --- /dev/null +++ b/gergelypolonkai_django/settings.py @@ -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, + }, + } +} diff --git a/gergelypolonkai_django/static/apple-touch-icon.png b/gergelypolonkai_django/static/apple-touch-icon.png new file mode 100644 index 0000000..598feb2 Binary files /dev/null and b/gergelypolonkai_django/static/apple-touch-icon.png differ diff --git a/gergelypolonkai_django/static/css/front.css b/gergelypolonkai_django/static/css/front.css new file mode 100644 index 0000000..de745ba --- /dev/null +++ b/gergelypolonkai_django/static/css/front.css @@ -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; +} + diff --git a/gergelypolonkai_django/static/favicon.ico b/gergelypolonkai_django/static/favicon.ico new file mode 100644 index 0000000..327adce Binary files /dev/null and b/gergelypolonkai_django/static/favicon.ico differ diff --git a/gergelypolonkai_django/static/images/deviantart_16.png b/gergelypolonkai_django/static/images/deviantart_16.png new file mode 100644 index 0000000..363accb Binary files /dev/null and b/gergelypolonkai_django/static/images/deviantart_16.png differ diff --git a/gergelypolonkai_django/static/images/email_16.png b/gergelypolonkai_django/static/images/email_16.png new file mode 100644 index 0000000..2cabb17 Binary files /dev/null and b/gergelypolonkai_django/static/images/email_16.png differ diff --git a/gergelypolonkai_django/static/images/facebook_16.png b/gergelypolonkai_django/static/images/facebook_16.png new file mode 100644 index 0000000..f0faf29 Binary files /dev/null and b/gergelypolonkai_django/static/images/facebook_16.png differ diff --git a/gergelypolonkai_django/static/images/google_plus_16.png b/gergelypolonkai_django/static/images/google_plus_16.png new file mode 100644 index 0000000..cc14390 Binary files /dev/null and b/gergelypolonkai_django/static/images/google_plus_16.png differ diff --git a/gergelypolonkai_django/static/images/googletalk_16.png b/gergelypolonkai_django/static/images/googletalk_16.png new file mode 100644 index 0000000..a003ddf Binary files /dev/null and b/gergelypolonkai_django/static/images/googletalk_16.png differ diff --git a/gergelypolonkai_django/static/images/linkedin_16.png b/gergelypolonkai_django/static/images/linkedin_16.png new file mode 100644 index 0000000..0ebcde0 Binary files /dev/null and b/gergelypolonkai_django/static/images/linkedin_16.png differ diff --git a/gergelypolonkai_django/static/images/profile.png b/gergelypolonkai_django/static/images/profile.png new file mode 100644 index 0000000..2df1c00 Binary files /dev/null and b/gergelypolonkai_django/static/images/profile.png differ diff --git a/gergelypolonkai_django/static/images/rss_16.png b/gergelypolonkai_django/static/images/rss_16.png new file mode 100755 index 0000000..f921046 Binary files /dev/null and b/gergelypolonkai_django/static/images/rss_16.png differ diff --git a/gergelypolonkai_django/static/images/skype_16.png b/gergelypolonkai_django/static/images/skype_16.png new file mode 100644 index 0000000..8978a15 Binary files /dev/null and b/gergelypolonkai_django/static/images/skype_16.png differ diff --git a/gergelypolonkai_django/static/images/tumblr_16.png b/gergelypolonkai_django/static/images/tumblr_16.png new file mode 100644 index 0000000..7bb562f Binary files /dev/null and b/gergelypolonkai_django/static/images/tumblr_16.png differ diff --git a/gergelypolonkai_django/static/images/twitter_16.png b/gergelypolonkai_django/static/images/twitter_16.png new file mode 100644 index 0000000..9f033ce Binary files /dev/null and b/gergelypolonkai_django/static/images/twitter_16.png differ diff --git a/gergelypolonkai_django/static/images/windows_16.png b/gergelypolonkai_django/static/images/windows_16.png new file mode 100644 index 0000000..7dc7910 Binary files /dev/null and b/gergelypolonkai_django/static/images/windows_16.png differ diff --git a/gergelypolonkai_django/templates/front_base.html b/gergelypolonkai_django/templates/front_base.html new file mode 100644 index 0000000..e389ce6 --- /dev/null +++ b/gergelypolonkai_django/templates/front_base.html @@ -0,0 +1,113 @@ +{% load static from staticfiles %} +{% load compress %} + + + + + + Gergely Polonkai{% block title %}{% endblock %} + + {% compress css %} + {% block css %} + + + {% endblock %} + {% endcompress %} + + + + +
+ +
+ +{% if tagCloud|length > 0 %} +
+{% for cloudItem in tagCloud %} + {{ cloudItem.name }}{% if not loop.last %} | {% endif %} +{% endfor %} +
+{% endif %} +
+{% block content %}{% endblock content %} +
+
+
+
+
+ :: Copyright © 2012, Gergely Polonkai :: Disclaimer :: +
+
+ Fork me on GitHub + + + + diff --git a/gergelypolonkai_django/urls.py b/gergelypolonkai_django/urls.py new file mode 100644 index 0000000..08e5347 --- /dev/null +++ b/gergelypolonkai_django/urls.py @@ -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)), +) diff --git a/gergelypolonkai_django/wsgi.py b/gergelypolonkai_django/wsgi.py new file mode 100644 index 0000000..2cb0a3c --- /dev/null +++ b/gergelypolonkai_django/wsgi.py @@ -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) diff --git a/manage.py b/manage.py new file mode 100644 index 0000000..c71c66c --- /dev/null +++ b/manage.py @@ -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)