more initial stuff
This commit is contained in:
@@ -1,8 +1,55 @@
|
|||||||
|
# SIKWEB 2.0
|
||||||
|
|
||||||
|
##Installation
|
||||||
|
|
||||||
|
### Create virtualenvironment for python
|
||||||
|
|
||||||
virtualenv -p python3 virtualenv.sikweb
|
virtualenv -p python3 virtualenv.sikweb
|
||||||
|
|
||||||
|
### clone This repo and enter it
|
||||||
|
|
||||||
|
git clone <url to repo>
|
||||||
|
cd <url to repo>
|
||||||
|
|
||||||
|
### Activate virtualenv (assuming we are on root of this repo and virtualenv is one step above)
|
||||||
|
`. ../virtualenv.sikweb/bin/activate`
|
||||||
|
|
||||||
|
### install required python modules
|
||||||
|
|
||||||
|
`pip install --upgrade pip`
|
||||||
|
`pip install -r requirements.txt`
|
||||||
|
|
||||||
|
|
||||||
|
### Install Mariadb and create necessary tables
|
||||||
|
|
||||||
Unsorted
|
`sudo apt-get install mariadb`
|
||||||
|
|
||||||
pip install --upgrade pip
|
```SQL
|
||||||
|
CREATE USER 'sik'@'localhost' IDENTIFIED BY 'jokutmpassu';
|
||||||
|
CREATE DATABASE sik DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
|
||||||
|
GRANT ALL PRIVILEGES ON sik.* TO 'sik'@'localhost';
|
||||||
|
CREATE DATABASE sik_test DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
|
||||||
|
GRANT ALL PRIVILEGES ON sik_test.* TO 'sik'@'localhost';
|
||||||
|
```
|
||||||
|
|
||||||
|
## Configure django's settings
|
||||||
|
|
||||||
|
cp sikweb/settings-sample.py sikweb/settings.py
|
||||||
|
|
||||||
|
edit database settings from sikweb/settings.py according to what you used above.
|
||||||
|
|
||||||
|
run `./manage.py migrate`
|
||||||
|
|
||||||
|
you should be now have succesfully setup a devel version of sikweb 2.0
|
||||||
|
|
||||||
|
## Running
|
||||||
|
|
||||||
|
### Activate virtualenv
|
||||||
|
|
||||||
|
assuming we are on root of this repo and virtualenv is one step above:
|
||||||
|
|
||||||
|
`. ../virtualenv.sikweb/bin/activate`
|
||||||
|
|
||||||
|
### use runserver command
|
||||||
|
`./manage.py runserver`
|
||||||
|
`or./manage.py runserver 0.0.0.0:8000` if you need to connect from anywhere else than localhost
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
Django==1.9
|
||||||
|
mysqlclient==1.3.7
|
||||||
|
pytz==2016.4
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.9 on 2016-05-18 22:59
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
import django.utils.timezone
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Info',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('publish_time', models.DateTimeField(default=django.utils.timezone.now)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='InfoTr',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('lang', models.CharField(default='fi', max_length=2)),
|
||||||
|
('topic', models.CharField(max_length=255)),
|
||||||
|
('content', models.TextField()),
|
||||||
|
('translation_for', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='webapp.Info')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Tag',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('dummyname', models.CharField(max_length=127)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='TagTr',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('lang', models.CharField(default='fi', max_length=2)),
|
||||||
|
('name', models.CharField(max_length=127)),
|
||||||
|
('translation_for', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='webapp.Tag')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='info',
|
||||||
|
name='tags',
|
||||||
|
field=models.ManyToManyField(related_name='news', to='webapp.Tag'),
|
||||||
|
),
|
||||||
|
]
|
||||||
+30
-1
@@ -1,3 +1,32 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
|
class Tag(models.Model):
|
||||||
|
dummyname = models.CharField(max_length=127) # ALWAYS USE TRANSLATED NAME!!!
|
||||||
|
|
||||||
|
class TagTr(models.Model):
|
||||||
|
'''
|
||||||
|
Model containing translations for tags
|
||||||
|
'''
|
||||||
|
lang = models.CharField(max_length=2, default='fi')
|
||||||
|
name = models.CharField(max_length=127)
|
||||||
|
translation_for = models.ForeignKey('Tag', related_name='translations')
|
||||||
|
|
||||||
|
class Info(models.Model):
|
||||||
|
'''
|
||||||
|
model containing something showing on some info feed
|
||||||
|
'''
|
||||||
|
publish_time = models.DateTimeField(default=timezone.now)
|
||||||
|
#published_by = models.Foreignkey(User) #<-- TODO create usermodel
|
||||||
|
tags = models.ManyToManyField(Tag,related_name="news")
|
||||||
|
|
||||||
|
class InfoTr(models.Model):
|
||||||
|
'''
|
||||||
|
Model containing translations for news
|
||||||
|
'''
|
||||||
|
lang = models.CharField(max_length=2, default='fi')
|
||||||
|
|
||||||
|
topic = models.CharField(max_length=255)
|
||||||
|
content = models.TextField()
|
||||||
|
translation_for = models.ForeignKey('Info', related_name='translations')
|
||||||
|
|
||||||
# Create your models here.
|
|
||||||
|
|||||||
Reference in New Issue
Block a user