Git Product home page Git Product logo

blogg's Introduction

Yet another django blog application

Blog application written in Django + python with livejournal.com compatible xmlrpc

Warning: xmlrpc api support almost nothing compared to the real one - create or update post with subject and body

Install

For newcomers in python world it's kind of a mess. Even if we skip python 2.x vs python 3.x drama, we still have to make gazilion of choices. Since installing all modules system wide is not in fashion, there are some options to have a local env. What would you choose - virtualenv? venv? And what are all those virtualenvwrapper, pew, penv and friends?

This project went with on of possible setups. Initial install is neatly outlined there.

Don't create your own project though, because you already have blogg!

To manage dependencies we will use pipenv, because it's closer to sanity. Most guides recommend local install, but only a system one worked for me

# ubuntu
$ sudo pip3 install pipenv

Nice. Once that's done, it's time to install postgresql and setup database and user there.

$ sudo apt-get install postgresql-9.5

Database setup (borrowed from here):

$ sudo -u postgres psql
psql (9.5.11)
Type "help" for help.

postgres=# create database blogg;
CREATE DATABASE
postgres=# create user blogg with password '<your password there>';
CREATE ROLE
postgres=# alter role blogg  SET client_encoding TO 'utf8';
ALTER ROLE
postgres=# alter role blogg  SET default_transaction_isolation TO 'read committed';
ALTER ROLE
postgres=# alter role blogg   SET timezone TO 'UTC';
ALTER ROLE
postgres=# GRANT ALL PRIVILEGES ON DATABASE blogg to blogg;
GRANT
postgres=# \q

Next, create .env file in the root of this repo with following content:

SECRET_KEY=<large random string>
DEBUG=True
DB_NAME=blogg
DB_USER=blogg
DB_PASSWORD=<your password from previous step there>
DB_HOST=127.0.0.1
BASE_URL=http://localhost:8000

Once that's done, running blogg is just a matter of

$ cd /path/to/blogg
$ pipenv install
$ pipenv run python3 manage.py migrate
$ pipenv run python3 manage.py runserver

Adding user

Blogg is set up using pipenv, so we'll use it to get into proper virtual environment and then we'll jump recursively into another shell, python this time, to create new user.

$ pipenv shell
$ python manage.py shell
Python 3.5.2 (default, Nov 23 2017, 16:37:01) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from web.models import User
>>> user = User.objects.create_user('john', '[email protected]', 'test1234')

Cl-journal integration

cl-journal is a livejournal client, which can work with blogg. Follow instructions from it's home page to get it up and running. After that you can start using it with blogg with a following command:

$ mkdir my-blog
$ cd my-blog
$ cl-journal init http://localhost:8000/xmlrpc

Where http://localhost:8000 should be replaced with a base url your instance of blogg works on

Notes

Just in case you forgot, you can get to pgsql shell using:

sudo -u postgres psql

And small cheatsheet:

  • \l - list all databases
  • \c <db> - switch to database <db>
  • \dt - show all tables in the active database
  • \d <table> describe table
  • every statement should end with semicolon. If your statement do not work, this is why.

blogg's People

Contributors

can3p avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.