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