Winza

Motivation.

Published: June 13, 2016, 9:02 p.m.

This site isn't dead just yet.  I need some motivation to do stuff.  

Categories: General

Starting Django - part 2.

Published: May 7, 2016, 11:13 p.m.

In my last post, I had successfully created a project and managed to run it through a browser.  

 

Some files were created such as settings.py, urls.py and manage.py.  Settings.py was pretty self-explanatory - it contained all the setting directives and configures the django project.   Urls.py maps urls to view functions and manage.py was a gateway for me to do other django like things:

python manage.py shell >> runs the shell command.

python manage.py migrate >> migrate the database

python manage.py makemigrations >> sets up the database for migrations if there is a change in the fields.

python manage.py collectstatic >> moves files to a central static location

python manage.py runserver [<ip>:8000] starts the django web server at <ip>:8000 .

 

The above page was a little boring and it had no content.  Before I added any content, I first had to create a web app:

django-admin.py startapp blog

Once the command was executed, it created a whole bunch of files in the blog directory - models.py and views.py are the two most important ones which I will delve into later on.

Before I made any models, I went into settings.py to add 'blog' as an installed app and changed the timezone to suit my location

INSTALLED_APPS = [

    'django.contrib.admin',

    'django.contrib.auth',

    'django.contrib.contenttypes',

    'django.contrib.sessions',

#    'django.contrib.sites',

    'django.contrib.messages',

    'django.contrib.staticfiles',

    'django.contrib.admindocs',

    'tinymce',

    'blog',

]

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'Australia/Melbourne'

 

To be continued... 

 

Categories: Coding Django

Starting Djagno - the nth attempt part 1

Published: April 9, 2016, 5:42 p.m.

Django - is a web application framework that I started to play with.  It was introduced to me a few years ago during a pycon in Hobart and I tried to learn it, attending workhops and going through the official tutorial.  But no matter how hard I tried to learn it, it never made any sense to me.  Now that I am slowly picking it up, I decide to document everything I learn about it.  

First I had to install apache.  In debian, I used the command:

apt-get install apache2

Once apache is installed, I then had to install python:

apt-get install python2.7

Since I was taught python 2.7 at university and I am still learning, I stuck with python2 instead of transitioning to python 3.

In most tutorials, installing virtualenv is recommened before installing djagno to keep python environments separate. I guess this is in case I find myself installing multiple django apps on the server:

pip install virtualenv

Then I created a virtualenv environment called ENV1 in my /usr directory:

virtualenv ENV1

To activate the ENV1 virtual environment, I would use the command:

source bin/activate

and to deactivate it, I would type in the following command:

deactivate

To install django, I activated my virtualenv and then typed in 

pip install django==1.9.5

This will start the django installation process. 

Once django is installed, I created a project called winzablog:

django-admin.py startproject winzablog

cd winzablog

python manage.py runserver <ipaddr>:8000

And type in <ip addr>:8000 in the address bar of the browser.  The default django page appears:

 

So Django's installed.  Time to create an app.  

To be continued...

Categories: Coding Django

Tinymce Test

Published: April 2, 2016, 3:01 p.m.

Cherry Blossoms

This is testing the django app tinymce

Categories: General

April Fools

Published: April 2, 2016, 12:34 a.m.

Test

Categories: General

Howdy

Published: April 1, 2016, 11 a.m.

test

Categories: General Coding