Project

General

Profile

Setup And Install » History » Version 3

« Previous - Version 3/23 (diff) - Next » - Current version
Luke Murphey, 12/13/2012 07:16 AM


Setup And Install

Below are instructions for how to run your own instance of TextCritical.

Install Prerequisites

To run TextCritical, you will need:

Install TextCritical Application

Check out the source code from http://svn.lukemurphey.net/textcritical.com using a Subversion client.

Copy start_here_settings.py to settings.py (under the src directory). Update the settings.py file per your host.

Configure Initialize Database

Specify a database in settings.py unless you intend to use SQLite.

After configuring the database, run syncdb (from the src directory):

python manage.py syncdb

Import Works

You will need to import the works into the library in order to have something for the site to provide access to. The easy way to do this is to use a prebuilt library. The more difficult way is to import the works yourself.

Using Existing Library

To use an existing library, copy the library.sqlite file to the server. By default, it should be placed in the src directory.

Importing Works

If you want to import works manually, then following the steps below.

First, initialize the library database.

python manage.py syncdb --database=library

Next, download the relevant works. The Perseus works can be obtained from Perseus.tufts.edu. Make sure to get the classics library. Decompress the archive.

Start the import process by running the following command, substituting "/Users/Luke/Perseus_Directory" with the location where you placed the files:

python manage.py batch_import_perseus -d "/Users/Luke/Perseus_Directory" 

The import process may take a while (it takes about 40 minutes on a Core i7 with 8 GB of RAM).

Start Web Server

For production installs, you ought to use a production web-server like Apache. For development you can use the built in web-server:

python manage.py runserver 0.0.0.0:8080

Issues

Syncdb Fails Saying it couldn't create "django_content_type"

This has something to do with database routing. It can be solved by adding the following to the settings.py file and re-running syncdb:

DATABASE_ROUTING = []

Syncdb Fails When Creating Superuser

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): yes                                                                                             
Traceback (most recent call last):                                                                                                          
  File "manage.py", line 10, in <module>                                                                                                    
    execute_from_command_line(sys.argv)                                                                                                     
  File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line                  
    utility.execute()                                                                                                                       
  File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute                                    
    self.fetch_command(subcommand).run_from_argv(self.argv)                                                                                 
  File "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv                                  
    self.execute(*args, **options.__dict__)                                                                                                 
  File "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute                                        
    output = self.handle(*args, **options)                                                                                                  
  File "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", line 371, in handle                                         
    return self.handle_noargs(**options)                                                                                                    
  File "/usr/local/lib/python2.7/site-packages/django/core/management/commands/syncdb.py", line 110, in handle_noargs                       
    emit_post_sync_signal(created_models, verbosity, interactive, db)                                                                       
  File "/usr/local/lib/python2.7/site-packages/django/core/management/sql.py", line 189, in emit_post_sync_signal                           
    interactive=interactive, db=db)                                                                                                         
  File "/usr/local/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 172, in send                                            
    response = receiver(signal=self, sender=sender, **named)                                                                                
  File "/usr/local/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py", line 73, in create_superuser                    
    call_command("createsuperuser", interactive=True, database=db)                                                                          
  File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 150, in call_command                               
    return klass.execute(*args, **defaults)                                                                                                 
  File "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute                                        
    output = self.handle(*args, **options)                                                                                                  
  File "/usr/local/lib/python2.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 70, in handle              
    default_username = get_default_username()                                                                                               
  File "/usr/local/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py", line 105, in get_default_username               
    default_username = get_system_username()                                                                                                
  File "/usr/local/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py", line 85, in get_system_username                 
    return getpass.getuser().decode(locale.getdefaultlocale()[1])                                                                           
TypeError: decode() argument 1 must be string, not None   

You may need to set your locale by running the following before running syncdb:

export LC_ALL="en_US.UTF-8" 

Delete the auth_users table and do another syncdb to try again.

See https://code.djangoproject.com/ticket/16017