[Dev] Update of web site code (parabolaweb)

Luke T.Shumaker lukeshu at sbcglobal.net
Wed Nov 30 22:41:14 GMT 2011


At Wed, 30 Nov 2011 11:04:35 -0300,
Nicolás Reynolds wrote:
> 
> [1  <text/plain; utf-8 (quoted-printable)>]
> El 29/11/11 09:41, Luke T.Shumaker dijo:
> > At Tue, 29 Nov 2011 19:58:35 +0100,
> > Johannes Krampf wrote:
> > > 2011/11/29 Nicolás Reynolds <fauno at kiwwwi.com.ar>:
> > > > El 29/11/11 05:17, Johannes Krampf dijo:
> > > >> Hello everyone,
> > > >>
> > > >> these days I finally managed to merge changes from archweb to
> > > >> parabolaweb and I published the results at
> > > >> https://www.johkra.net/gitweb/ .
> > > >>
> > > >> I would like to help bringing this work forward and hopefully result
> > > >> in resolving issue 210 [1]. How could I provide further help?
> > > >
> > > > great! can you test it locally? otherwise i can pull your changes after
> > > > thursday...
> > > 
> > > I have *not* tested it well enough. I suffered from
> > > https://bugs.archlinux.org/task/23228 and couldn't load the fixtures
> > > to test with data. I tested the rest by clicking through the pages and
> > > checking links.
> > > 
> > > Since I'm not very experienced with Django and the error message is
> > > not concrete enough, I do not understand what exactly is going wrong.
> > > I actually hoped you might know more about this. Do you?
> > 
> > Even setting up the old version, I get that error too. Also, it (the
> > old version) 404s on "/media/*".
> > 
> > So, I have not really been able to test it, but I've added 2 commits.
> > The first is a bunch of whitespace changes to make future merging
> > cleaner.
> > The second is to remove bin/ and lib/, which are set up by virtualenv;
> > surely we don't want to track those.
> > 
> > https://gitorious.org/parabolaweb/parabolaweb
> 
> i recommend both of you to test it with sqlite3. we're using postgresql on the
> server. this because luke had problems with mysql...

So far I've had tried (and had errors with)
 * MySQL/InnoDB (won't work, will require patch if we want it to)
 * MySQL/MyISAM (mostly works, idk why)
 * sqlite3 (doesn't work, idk why)

To clarify/document:

Parabolaweb does not work with MySQL InnoDB. (Which is odd, because
the local_settings.py.example distributed with archweb explicitly sets
the engine to InnoDB)

Running `./manage.py migrate` will raise an error `1005' (Couldn't
create table) with an errno 121. Errno 121 is undocumented, but
appears to be related to validating references. 

This is easily remedied by switching MySQL to MyISAM or another
engine.
    DATABASES = {
        'default': {
            'ENGINE'  : 'django.db.backends.mysql',
            ...
            'OPTIONS' : {'init_command': 'SET storage_engine=MyISAM'},
        },
    }

After some research, this is my analysis of what is causing the issue,
but I may be wrong:

This is because InnoDB does some more advanced things with
references. This is normally identified as a feature.

However, this causes a bug in Django < 1.4. (parabolaweb/archweb use
Django 1.3)

From the Django documentation:
> In previous versions of Django, fixtures with forward references
> (i.e. relations to rows that have not yet been inserted into the
> database) would fail to load when using the InnoDB storage
> engine. This was due to the fact that InnoDB deviates from the SQL
> standard by checking foreign key constraints immediately instead of
> deferring the check until the transaction is committed. This problem
> has been resolved in Django 1.4. Fixture data is now loaded with
> foreign key checks turned off; foreign key checks are then
> re-enabled when the data has finished loading, at which point the
> entire table is checked for invalid foreign key references and an
> IntegrityError is raised if any are found.

Which appears to exactly describe the error I was having.

After switching to MySQL MyISAM I got farther.
I ran into the same problem that Johannes did
(https://bugs.archlinux.org/task/23228),
By replacing the command
 $ ./manage.py loaddata */fixtures/*.json
with
 $ for file in */fixtures/*.json; do ./manage.py loaddata $file; done
in order to still load all the other fixtures.

From there the only problem seemed to be that '/media/*' URLs (static
files) would 404. I'd now guess that this is caused by something
misconfigured in local_settings.py, not an external dependency.

When I tried with sqlite3, setting it up was identical to setting it
up with MySQL MyISAM. However, when I ran the server I got 500 (server
error). It would print a stack trace (attatched), but tl;dr:
> ViewDoesNotExist: Could not import packages.views. Error was: cannot
> import name SignoffSpecification 

Happy Hacking!
~ Luke Shumaker



More information about the Dev mailing list