Setup And Install » History » Version 3
Version 2 (Luke Murphey, 11/17/2012 12:44 AM) → Version 3/23 (Luke Murphey, 12/13/2012 07:16 AM)
h1. Setup And Install
Below are instructions for how to run your own instance of TextCritical.
h2. Install Prerequisites
To run TextCritical, you will need:
* "Django 1.4.*":https://www.djangoproject.com/download/
* "Python 2.7":http://www.python.org/getit/
* A database (you can use SQLite to avoid setting up a database)
h2. Install TextCritical Application
Check out the source code from http://svn.lukemurphey.net/textcritical.com using a "Subversion client":http://en.wikipedia.org/wiki/Comparison_of_Subversion_clients.
Copy start_here_settings.py to settings.py (under the src directory). Update the settings.py file per your host.
h2. 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):
<pre>
python manage.py syncdb
</pre>
h2. 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.
h3. 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.
h3. Importing Works
If you want to import works manually, then following the steps below.
First, initialize the library database.
<pre>
python manage.py syncdb --database=library
</pre>
Next, download the relevant works. The Perseus works can be obtained from "Perseus.tufts.edu":http://www.perseus.tufts.edu/hopper/opensource/download. 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:
<pre>
python manage.py batch_import_perseus -d "/Users/Luke/Perseus_Directory"
</pre>
The import process may take a while (it takes about 40 minutes on a Core i7 with 8 GB of RAM).
h2. 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:
<pre>
python manage.py runserver 0.0.0.0:8080
</pre>
h2. Issues
h3. 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:
<pre>
DATABASE_ROUTING = []
</pre>
h3. Syncdb Fails When Creating Superuser
<pre>
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
</pre>
You may need to set your locale by running the following before running syncdb:
<pre>
export LC_ALL="en_US.UTF-8"
</pre>
Delete the auth_users table and do another syncdb to try again.
See https://code.djangoproject.com/ticket/16017
Below are instructions for how to run your own instance of TextCritical.
h2. Install Prerequisites
To run TextCritical, you will need:
* "Django 1.4.*":https://www.djangoproject.com/download/
* "Python 2.7":http://www.python.org/getit/
* A database (you can use SQLite to avoid setting up a database)
h2. Install TextCritical Application
Check out the source code from http://svn.lukemurphey.net/textcritical.com using a "Subversion client":http://en.wikipedia.org/wiki/Comparison_of_Subversion_clients.
Copy start_here_settings.py to settings.py (under the src directory). Update the settings.py file per your host.
h2. 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):
<pre>
python manage.py syncdb
</pre>
h2. 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.
h3. 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.
h3. Importing Works
If you want to import works manually, then following the steps below.
First, initialize the library database.
<pre>
python manage.py syncdb --database=library
</pre>
Next, download the relevant works. The Perseus works can be obtained from "Perseus.tufts.edu":http://www.perseus.tufts.edu/hopper/opensource/download. 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:
<pre>
python manage.py batch_import_perseus -d "/Users/Luke/Perseus_Directory"
</pre>
The import process may take a while (it takes about 40 minutes on a Core i7 with 8 GB of RAM).
h2. 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:
<pre>
python manage.py runserver 0.0.0.0:8080
</pre>
h2. Issues
h3. 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:
<pre>
DATABASE_ROUTING = []
</pre>
h3. Syncdb Fails When Creating Superuser
<pre>
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
</pre>
You may need to set your locale by running the following before running syncdb:
<pre>
export LC_ALL="en_US.UTF-8"
</pre>
Delete the auth_users table and do another syncdb to try again.
See https://code.djangoproject.com/ticket/16017