RestAuth is configured like any other Django project, in the file settings.py. You should never edit this file directly, instead always edit the (much better documented) localsettings.py. This file is included by settings.py and should, as its name suggests, set anything that is specific to your local installation. The file includes any settings you are likely to edit, but you can actually configure any Django setting you want there. Please consult Settings on noteworthy configuration variables.
By default, you have to do very few modifications to localsettings.py. The only settings you have to configure are the DATABASES and SECRET_KEY settings.
The DATABASES setting is quite flexible. Please also consult the database specific notes for any particularities of your Database system. You have to create and initialize the database.
Note
Exhaustive documentation on how to create a database is outside the scope of this document. If in doubt, always consult the official documentation of your database system.
Warning
RestAuth requires a database with transactional support. Most notably, the MyISAM MySQL storage engine (which is the default on many systems, does not support transactions. Please use InnoDB instead.
Here is an example shell session for creating a MySQL database:
mysql -uroot -pYOUR_PASSWORD -e "CREATE DATABASE restauth CHARACTER SET utf8;"
mysql -uroot -pYOUR_PASSWORD -e "GRANT ALL PRIVILEGES ON restauth.* TO 'restauth'@'localhost'
IDENTIFIED BY 'MYSQL_PASSWORD'"
The correct DATABASES setting then would be:
DATABASES = {
'default': {
'ENGINE': 'mysql',
'NAME': 'restauth',
'USER': 'restauth',
'PASSWORD': 'MYSQL_PASSWORD', # you really should change this!
'HOST': '',
'PORT': '',
}
}
Please also see the MySQL notes (especially the Creating your database chapter) on the subject. The database tables must not use the MyISAM storage engine, please make sure you use InnoDB or any other engine that supports transactions. Django provides some instructions on how to convert a database to InnoDB.
If you choose to use PostgreSQL, you can create a database like this, assuming you are already the user postgres:
createuser -P restauth
psql template1 CREATE DATABASE restauth OWNER restauth ENCODING ‘UTF8’;
The correct DATABASES setting then would be:
DATABASES = {
'default': {
DATABASE_ENGINE = 'postgresql_psycopg2',
DATABASE_NAME = 'restauth',
DATABASE_USER = 'restauth',
DATABASE_PASSWORD = 'POSTGRES_PASSWORD', # you really should change this!
DATABASE_HOST = '',
DATABASE_PORT = '',
}
}
Please also see the PostgreSQL notes in the Django documentation.
If you are using SQLite, which is not recommended on any production setup, you do not have to do anything except making sure that the directory named in NAME is writable by the webserver.
Once you have created your database, you can easily create the necessary tables using the syncdb command of manage.py. If you installed from source, you can simply run this inside the RestAuth/ directory found in the source code:
python manage.py syncdb
If you used a distribution-specific way to install RestAuth, the command is most likely called restauth-manage:
restauth-manage syncdb
By default, usernames in RestAuth can contain any UTF-8 character except a slash (‘/’), a backslash (‘\’) and a colon (‘:’).
Validators are used to restrict usernames further if certain characters are unavailable in some systems that use your RestAuth installation. Consider the following scenario: Your RestAuth server provides accounts for a MediaWiki (that’s also used to register new accounts) and an XMPP server. MediaWiki has no problems with usernames containing spaces, but the XMPP protocol forbids that. In this scenario, you would want the xmpp validator to block creating users where the username contains a space.
Please see SKIP_VALIDATORS for a list of available validators.