Ubuntu 10.10 Pentax K-5

Wednesday, May 15, 2013

Problems in Django Setups

1. How to run the activate of virtualenv

You need to change to bash first if your default shell is not.
> bash
$ source bin/activate

2. Apache2 Issues
2.1.Where is the log for apache2?
/var/log/apache2/error.log
2.2 how to create virtualhost at apache2
In site-available, create the file, e.g. pms
$ a2ensite pms
It will create a symbolic link in site-enabled folder.

3. Why it can't find all my tables?

If you use sqlite3 database for django backend, you need to put the absolute path of the sqlite3 file rather than relative path.

'NAME': '/tmp/mysite.sqlite3',

4. Database error: attempt to write a readonly database
This happens for sqlite3 database.
For linux, you need to set the write permission for both sqlite3 file and its folder
$ chmod a+x pms
$ cd pms
$ chmod a+x dev.db

5. How to disable signup for django website?
In the settings.py, change ACCOUNT_OPEN_SIGNUP to false;

Check the rest for need email confirmation or not.


ACCOUNT_OPEN_SIGNUP = False
ACCOUNT_USE_OPENID = False
ACCOUNT_REQUIRED_EMAIL = False
ACCOUNT_EMAIL_VERIFICATION = False
ACCOUNT_EMAIL_AUTHENTICATION = False
ACCOUNT_UNIQUE_EMAIL = EMAIL_CONFIRMATION_UNIQUE_EMAIL = False




Monday, April 15, 2013

Sqlite3 dump to sql and read from sql

Objective:
* to dump the sqlite3 database to sql file
* to read the sql file into an empty sqlite3 database

1. >sqlite3 dev.db '.dump'>temp.sql
2. >sqlite3 temp.db
    sqlite> .help
    sqlite> .read temp.sql

Friday, March 22, 2013

django Plugins used

1. django-schedule (for event of calendar)
https://github.com/bartekgorny/django-schedule

2. django-photologue (for gallery)
https://code.google.com/p/django-photologue/
https://code.google.com/p/django-photologue/wiki/ReadMe

Install PIL on mac (Snow Leopard) for django


http://proteus-tech.com/blog/cwt/install-pil-in-snow-leopard/
(转)
====


 I download libjpeg latest version (http://www.ijg.org/files/jpegsrc.v7.tar.gz), untar it, and configure it:

$ tar zxvf jpegsrc.v7.tar.gz
$ cd jpeg-7
$ ./configure --enable-shared --enable-static
$ mzake
$ sudo make install
Now, you just installed libjpeg into /usr/local/lib. So, it's time to install PIL. Download the PIL source code from http://effbot.org/downloads/Imaging-1.1.6.tar.gz then untar it:

$ tar zxvf Imaging-1.1.6.tar.gz
$ cd Imaging-1.1.6
This is the trick, you must open setup.py with your prefered text editor then looking for the line JPEG_ROOT = None and then it to JPEG_ROOT = libinclude("/usr/local") then save the file and continue:

$ python setup.py build
If everything fine, you can install PIL to your system library. If the PIL need something that didn't exist, it will tell you on the error message. You may install the missing library via fink or download and compile it by yourself. Then install the PIL as root:

$ sudo python setup.py install --optimize=1

* python selftest.py still shows "lib jpeg not available", but fact is that I can use it already