Install Django-timesheet (wheezy)

Source: Internet
Author: User
Tags install django postgres createdb

The boss said that he would like to build a demo version of the time table tool for him to see and find a few solutions. He still prefers timesheet. I have never touched on Django before, and it is full of pitfalls in the process. The final steps are as follows:

1. Install Pip

aptitude install python-pip

Ii. Pip install dependent components

apt-get install python-dateutilpip install django-selectablepip install django-paginationpip install django-compressorpip install django-bootstrap-toolkitaptitude install build-dep libpq-devapt-get install python-software-properties

3. Add the jessin source and install related software packages:

1. Add Source:

vim /etc/apt/souces.listdeb http://mirrors.163.com/debian/ jessie maindeb-src http://mirrors.163.com/debian/ jessie maindeb http://security.debian.org/ jessie/updates maindeb-src http://security.debian.org/ jessie/updates main# jessie-updates, previously known as ‘volatile‘deb http://mirrors.163.com/debian/ jessie-updates maindeb-src http://mirrors.163.com/debian/ jessie-updates main# jessie-backports, previously on backports.debian.orgdeb http://mirrors.163.com/debian/ jessie-backports maindeb-src http://mirrors.163.com/debian/ jessie-backports mainapt-get update

2. Install nodejs:

aptitude -t testing install nodejs

Create a soft link:

ln -s /usr/bin/js /usr/local/bin/node

3. Install NPM

aptitude -t testing install npm

4. Install less using NPM

npm install less -g

5. Install PostgreSQL

apt-get install postgresql-9.1   apt-get install postgresql-server-dev-9.1

Restart PostgreSQL

/etc/init.d/postgresql restart

6. Install the python-dev package

aptitude -t testing install python-devpip install psycopg2

 

7. Install DJANGO:

Note that if Django does not specify a version, 1.6.5 is installed by default, while 1.6.5 has removed the hashcompt module, while timepiece requires this module. Therefore, you need to manually change Django's default version to 1.4, otherwise, it cannot be started after installation. It took me a day!

pip install django-timepiece  django==1.4


8. Get Django-timepiece

Download the source code package on GitHub

Web https://github.com/caktus/django-timepiece

Download the package and upload it to the server, such as/home. decompress the file:

cd /home unzip django-timepiece-develop.zipcd django-timepiece-develop

Copy the manage. py script to the Django-timepiece directory:

cp example_project/manage.py .

Copy local. py. Example to local. py.

cd /home/django-timepiece-develop/example_project/settingscp local.py.example local.py


9. Modify the pgsql configuration file and create databases and users:

VI/etc/PostgreSQL/9.3/main/pg_0000.conflocal all peer change peer to MD5

Restart pgsql:

/etc/init.d/postgresql restart

Create a database:

Sudo-u Postgres createuser-D-P dbuser # create user Sudo-u Postgres createdb-O dbuser timepiece # Use user to create database


10. Modify the local. py configuration file:

vim example_project/settings/local.pyDATABASES = {    ‘default‘: {    ‘ENGINE‘: ‘django.db.backends.postgresql_psycopg2‘,    ‘NAME‘: ‘timepiece‘,    ‘USER‘: ‘dbuser‘,    ‘PASSWORD‘: ‘123456‘,    ‘HOST‘: ‘127.0.0.1‘,    ‘PORT‘: ‘5432‘, }}

Replace the database name, user, and password with the database and user information created in the previous step. Save and exit.

11. Synchronize configurations to the database

python manage.py syncdb

 

During synchronization, the system will allow you to set an access account, such as a user, password, email address, and so on. This is the login account information.

You just installed Django‘s auth system, which means you don‘t have any superusers defined.Would you like to create one now? (yes/no): yesUsername (leave blank to use ‘root‘): dbuserE-mail address: [email protected]Password: Password (again):

After the synchronization is completed, a prompt is displayed.

Superuser created successfully.Installing custom SQL ...Installing indexes ...Installed 0 object(s) from 0 fixture(s)

12. Start the program:

python manage.py runserver 0.0.0.0:8000

 

You can select an idle port. 0.0.0.0 allows all IP addresses to access the port, or you can add and run it in the background.

You can also redirect access logs to a specified log file:

Python manage. py runserver 0.0.0.0: 8000>/var/log/timesheet. log 2> & 1 &

0 k. Open your browser ~


This article is from the "DBQ blog" and will not be reproduced!

Install Django-timesheet (wheezy)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.