Package: django-phpBB3
Django-phpBB3Django-phpBB3 provides the database models of a existing phpBB3 installation. This is usefull for all people who like to access the phpbb forum database from a django application.
It’s not a phpBB clone or a forum!Django-phpBB3 has also a script for migrate a phpBB3 forum into aDjangoBB forum. See below.Notes:There are a few mismatches between the origin phpBB3 Database schema and themodels.pyform Django-phpBB3. Because of this: Creating the phpBB3 tables viasyncdbwill not work with phpBB3.phpBB3 used often0for a not set value, but we need a realnullvalue in db (to getNoneback)phpBB3 Models with composite keys are unsupported, but stored indjango_phpBB3/unsupported_models.pyWarning:
Write access to the original phpBB database is not tested, yet. So it’s not guaranteed that changes trough the django admin will work with phpBB3!
So, in the current state, you should only access ‘read-only’ to the origin phpBB3 data ;)Patches are welcome! Please send pull requests.example projectsWe add two example projects:`django_phpBB3_project`_minimal project without extra depencies`phpBB2DjangoBB_project`_DjangoBB example project for use the phpBB2DjangoBB migration commandsetup~$ virtualenv DjangoBB_env
~$ cd DjangoBB_env/
~/DjangoBB_env$ source bin/activate
(DjangoBB_env)~/DjangoBB_env$ pip install django-phpBB3 # Will also install Django(If default python interpreter is <2.7: Use:virtualenv-ppython2.7 DjangoBB_env- see below)Or if you will use the most recent git version:# install git read-only clone (Will also install Django):
(DjangoBB_env)~/DjangoBB_env$ pip install -e git+git://github.com/jedie/django-phpBB3.git#egg=django-phpBB3If you would like to test/use the DjangoBB migration install this:(DjangoBB_env)~/DjangoBB_env$ pip install -e git+git://github.com/slav0nic/DjangoBB.git#egg=DjangoBB
(DjangoBB_env)~/DjangoBB_env$ pip install WhooshMaybe you want mydevbranch of DjangoBB (More info inMy DjangoBB github wiki page):(DjangoBB_env)~/DjangoBB_env$ pip install -e git+git://github.com/jedie/DjangoBB.git@dev#egg=DjangoBB
(DjangoBB_env)~/DjangoBB_env$ pip install Whooshlocal_settings.py example# database table prefix (default is: "phpbb3_")
#PHPBB_TABLE_PREFIX = "phpbb_"

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': 'phpbb3', # Or path to database file if using sqlite3.
        'USER': 'phpbb3', # Not used with sqlite3.
        'PASSWORD': 'foo bar', # Not used with sqlite3.
        'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
        'PORT': '', # Set to empty string for default. Not used with sqlite3.
    }
}

# settings for phpBB3 migration:

# filesystem path to the /files/ sub directory of the phpBB installation:
# Set to None, if your phpBB3 forum has no attachments
PHPBB_ATTACHMENT_PATH = "/path/to/phpBB/files/"init databaseIf you will test the two example projects, you need to initialises the database, e.g.:~$ cd DjangoBB_env/
~/DjangoBB_env$ source bin/activate
(DjangoBB_env)~/DjangoBB_env$ cd src/django-phpbb3/phpBB2DjangoBB_project
(DjangoBB_env).../phpBB2DjangoBB_project$ # create local_settings.py here, see above!
(DjangoBB_env).../phpBB2DjangoBB_project$ ./manage.py syncdb --all
(DjangoBB_env).../phpBB2DjangoBB_project$ ./manage.py migrate --faketest django-phpBB3We added a test project for easy start in:/django_phpBB3_project/Create alocal_settings.pyinto/django_phpBB3_project/see example above.You must initialises the database (see above).You can startup a test server with, e.g:./manage.py runserver --traceback --insecuremigrate a phpBB3 installation to DjangoBBWe add a example project for a phpBB3 migration in:/phpBB2DjangoBB_project/The migration from phpBB3 to DjangoBB is implement as a migration command here:/django_phpBB3/management/commands/phpbb2djangobb.pyTo run the migration you can use the minimalphpBB2DjangoBBexample project example.
This project includes the DjangoBB forum app and django-phpBB3 app. Before start, you must install the dependencies!You must create alocal_settings.pyinto/phpBB2DjangoBB_project/see example above.Before you start migration:You should check if database encoding settings are ok.
To check, login and check inadmin / Django_phpBB3 / **Posts**if non-ascii characters are ok.Typical problem are: e.g. in default ubuntu/debian setup a mysql server will uselatin-1!
So before you start, you should correct this. e.g.:ALTER DATABASE test DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ciMake a SQL Backup before doing anything!!!Run the migration with./manage.py phpbb2djangobb, e.g:~$ cd DjangoBB_env/
~/DjangoBB_env$ source bin/activate
(DjangoBB_env)~/DjangoBB_env$ cd src/django-phpbb3/phpBB2DjangoBB_project
(DjangoBB_env).../phpBB2DjangoBB_project$ ./manage.py phpbb2djangobbafter migrationImportant:No phpBB forum permissions would be migrated, yet. So: Before you make a migrated Forum available to public, you must manuallyhideanyinternalforums, if exists!
To limit a forum in DjangoBB, e.g.:Create a new user group in django admin panelCreate a seperate djangobb category and add the creates user groupMoveinternalforums to the new categoryTo give a user the permissions to theinternalforums: Edit the user and add the created user group.You must update the haystack search index with e.g.:(DjangoBB_env).../phpBB2DjangoBB_project$ ./manage.py update_index --verbosity=2more information:http://django-haystack.readthedocs.org/en/latest/management_commands.htmlDepend on the used database you must reset sequences.Sequences are indexes used by some database engines to track the next available number for automatically incremented fields.more info:https://docs.djangoproject.com/en/dev/ref/django-admin/#sqlsequencereset-appname-appnameoptionscleanup_usersAdd--cleanup_users=xto setup which users are migrate, wherexis a number:0all users1users with email addresses (skip bots)2users with email and has a ‘lastvisit’ date(default)3email + lastvisit and has created at least one postmigration limitationsThings that would not be transfered, yet:Forum moderatorsCategory groupssort of Category / Forum would not be converted to position numberHandling missing features in DjangoBB:We transfer phpBB Users who are in the user groupADMINISTRATORSorGLOBAL_MODERATORSto all forum moderators.global postsandannouncementconverted to normal sticky postssub forums would be flattenghost moved postsare ignored (only the moved post would be created)ForumWatch are ignoredGuest posts would be mapped to a new “Anonymous” user (has unusable password and no email address). Note: guest posts are planed in DjangoBB, see:http://support.djangobb.org/topic/98/TODO:Handle forum permissions: Now all forums will be public, after migration!Bugfix for user post count migration -https://github.com/jedie/django-phpBB3/issues/6migrate user avatar -https://github.com/jedie/django-phpBB3/issues/7add a separate command for migrate phpBB private messages to django-messages (very low priority, patches are welcome)migration - notesusernameThe migration script copied the phpBB username 1:1 and doesn’t cleanup anything.
The django forms for creating/change a user will only limit with:Letters, digits and@/./+/-/_onlyBut the model fields is a simpleCharField.
A nick will be accepted in login depend on the login form you use in your project.passwordWe migrate the phpBB3 passwords and add a own password hasher.Django upgrade the old passwordwith the default hasher (PBKDF2) on the first login.
For this, it’s needed to add the phpBB3 password hasher to your settings, e.g.:PASSWORD_HASHERS = (
    'django.contrib.auth.hashers.PBKDF2PasswordHasher',
    'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
    'django.contrib.auth.hashers.BCryptPasswordHasher',
    'django.contrib.auth.hashers.SHA1PasswordHasher',
    'django.contrib.auth.hashers.MD5PasswordHasher',
    'django.contrib.auth.hashers.CryptPasswordHasher',
    'django_phpBB3.hashers.PhpBB3PasswordHasher',
)more info:https://docs.djangoproject.com/en/1.4/topics/auth/#how-django-stores-passwordsmigration - open questionsAre the phpBB times inphpbb_postsin UTC oder in local time from user?troubleshootingHTMLParseError while post migrationMaybe you used a older Python Version than 2.7.3 In older versions theHTMLParseris not so robust as in 2.7.3
Maybe default Python interpreter is 2.6, but 2.7 is installed to, than try:# Display the exsiting Python version:
~$ python --version # Default python
Python 2.6.6
~$ python2.7 --version # Try if 2.7 is available
Python 2.7.3

# Create env with 2.7:
~$ virtualenv -p python2.7 DjangoBB_envWork-a-round if you can’t create a virtualenv with a newer Python interpreter:
set:settings.DJANGOBB_SMILES_SUPPORT = FalseMore Information here:https://github.com/jedie/django-phpBB3/issues/14UnicodeEncodeError in the terminal while running migrationSolution: You must set either your locale, or the ​PYTHONIOENCODING environment variable, according to your terminal’s encoding — in most cases, utf-8.
More info can be foundin the comment of issues 9How to debug migrationWe use python built-in pdb module for debug a migration traceback.pudbis used, if installed. To install it, run e.g.:~$ cd DjangoBB_env/
~/DjangoBB_env$ source bin/activate
(DjangoBB_env)~/DjangoBB_env$ pip install pudbphpBB3 linksHere some links for phpBB documentations:http://wiki.phpbb.com/Tableshttp://www.phpbbdoctor.com/doc_tables.phpThe SQL schema files from phpBB can be found here:https://github.com/phpbb/phpbb3/tree/develop/phpBB/install/schemashistoryv0.3.0 - 25.09.2012migrate phpBB3 passwords, too and add a PASSWORD_HASHERS for this, see below.v0.2.1 - 21.09.2012Add “is_staff” flag to all “global moderators”Set “is_active” flag depent on “user_inactive_time”Add--only_usersfor only migrate/update users.Usefor getting the pseudo “Anonymous” user accountv0.2.0 - 21.09.2012Speedup migration by disable haystack search index creation.Bugfix: Handle not existing phpBB users -> Map to Anonymous user.Add support for pudb debugger (optional) and fallback to pdbBugfix in migration: clean user signature, too.Don’t check PHPBB_ATTACHMENT_PATH if no attachments exists in phpBB3 forum.Avoid UnicodeEncodeError in migration outputSpeedup user migration by stats only outputAdd--flush_djangobband--max_entriesin migration command for testing.v0.1.6 - 29.08.2012Add more information in READMEFix unicode errorsv0.1.5 - 31.07.2012migrate user language, too.v0.1.4 - 30.07.2012many bugfixes in models.v0.1.3 - 27.07.2012catch error if a post can’t be migrated and continue migrationremove django_authopenid and django_messages from phpbb2djangobb project settingsnicer output while migrating with eta timev0.1.2 - 27.07.2012remove date from version stringadd this histroy list ;)v0.1.0 - 24.07.2012migrate post subscriptions, too.23.07.2012migrate phpBB3 file attachments, too.bugfixes in bbcode cleanuphandle html entities in cleanup20.07.2012bbcode cleanup contributed by nitely19.07.2012start with phpBB3 migration command16.07.2012project starts by Jens DiemerProject linksHomepagehttps://github.com/jedie/django-phpBB3PyPihttp://pypi.python.org/pypi/django-phpBB3/donationFlattr this!SendBitcoinsto1YJk2JTMyDrZ8oTHkMhTaQtRWqSgrHPiScontactCome into the conversation, besides the github communication features:Forumhttp://www.pylucid.org/en/forum/11/IRC#pylucid on freenode.net (Yes, the PyLucid channel…)webchathttp://webchat.freenode.net/?channels=pylucid