Re: manage.py migrate issue

869 views
Skip to first unread message

Griatch Art

unread,
May 24, 2013, 5:27:18 AM5/24/13
to eve...@googlegroups.com
Hi and welcome to Evennia! Sorry to hear you have trouble getting started. 

I just pulled a clean copy of the latest Evennia and everything installed just fine. So there is no simple bug introduced in the distribution at least. This was under debian testing, but I regularly run Evennia on Mint14 elsewhere and I know there are others using Ubuntu. Evennia is generally very easy to set up on Linux so you probably face some further incompatibilities in the libraries. It seems some of your post above was cut short (it seems you use a verbatim code block to write your text) so I can't read just what you did to update Django to the latest version or which version of django-south you use. 

Your superuser-info is irrelevant to the issue I think (note also that you don't need to supply a valid email, as long as it's on a general email form). Your settings should also not be able to mess up the migration (certainly not by changing valid settings parameters like SERVERNAME!).

Things to test: 
Delete game/settings.py file. It will be recreated by running manage.py once. 
I assume you are using the default sqlite3 database. Delete game/evennia.db3 and re-run ./manage.py syncdb to recreate things from scratch, then migrate again.

If this still doesn't work, let's rule out local issues with dependencies in your distribution, you can try setting up a virtualenv as described here:  https://code.google.com/p/evennia/wiki/GettingStarted (scroll down to the virtualenv section). This sets up a special python environment where all the latest libraries are installed. Pull evennia to this and retry the install to see if things work better. 

If this still is an issue at this point you need to give us more info about the error. The error you report seems overly brief. There should be a traceback listed as well. Include that in a pastebin and we'll see if we can't figure out what's wrong. :) 
.
Griatch

On Friday, May 24, 2013 9:55:35 AM UTC+2, Greyhart wrote:
I've spent the last few days looking for something to use on my website, to encourage community and fun. I think Evennia is it.

Now my problem:

I wanted to set up a local version of Evennia to play with, so I downloaded and installed Ubuntu 12.04.2

I then used the suggested command
apt-get install python python-django python-twisted mercurial python-django-south
to pull down all the required files. I found that it pulls down an older version of Django, which isn't supported for this install, so I downloaded v1.5.1 and installed it.

I went through a smooth install until I got to python manage.py migrate.
Now I had originally copied and pasted the SERVERNAME = into settings.py and changed it. I also copied/pasted the TIME_ZONE and changed it from 'UTC' to 'MST7MDT' for Denver.

The migrate command gave me the following:

Running migrations for server:
- Migrating forwards to 0002_fix_config_value.
> server:0001_rename_config_table_to_server_table
> server:0002_fix_config_value
- Loading initial data for server.
Installed 0 object(s) from 0 fixture(s)
Running migrations for players:
- Migrating forwards to 0019_remove_old_attr_value_field.
> objects:0001_initial
> players:0001_initial

KeyError: u'db_key'

I figured one of my changes to the settings.py file must be bad, so I started deleting changes until I got back to a clean settings.py file. I have been deleting the evennia.db3 file between runs, otherwise it throws another error about players_playerattributes already exists.
I have been playing with this for hours now, I'm stumped, and it's 2am.

I did create a SU each time the python manage.py syncdb command was run.
Super User ID is kenb (all lowercase)
Email=my valid email address
Password is 98226241 (local install, so I'm not worried about anyone logging on)

Any ideas?

Greyhart

Kelketek Rritaa

unread,
May 24, 2013, 8:10:14 AM5/24/13
to eve...@googlegroups.com
Running:

./manage migrate --traceback

Should force a full traceback to be displayed. Last I checked a full traceback is no longer displayed by default in the latest versions of Django/South.
--
--
You received this message because you are subscribed to the "Evennia" MU* server mailing list.
To post to this group, send email to eve...@googlegroups.com (or use the web interface).
To unsubscribe from this group, send email to evennia+u...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/evennia?hl=en
 
---
You received this message because you are subscribed to the Google Groups "Evennia" group.
To unsubscribe from this group and stop receiving emails from it, send an email to evennia+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Greyhart

unread,
May 24, 2013, 5:30:11 PM5/24/13
to eve...@googlegroups.com
Ok, I deleted the settings.py  from evennia/game, as well as the evennia.bd3 from the same directory.
I reran:

python manage.py - no issues
python manage.py syncdb - no issues
python manage.py migrate -- traceback

This is what I got:

greyhart@greyhart-ubuntu:~/evennia/game$ python manage.py syncdb
Syncing...
Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_groups
Creating table auth_user_user_permissions
Creating table auth_user
Creating table django_site
Creating table django_content_type
Creating table django_session
Creating table django_admin_log
Creating table django_flatpage_sites
Creating table django_flatpage
Creating table news_newstopic
Creating table news_newsentry
Creating table south_migrationhistory

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
Username (leave blank to use 'greyhart'): kenb
Email address: grey...@castle-luna.com
Password:
Password (again):
Superuser created successfully.
Installing custom SQL ...
Installing indexes ...

Installed 0 object(s) from 0 fixture(s)

Synced:
 > django.contrib.auth
 > django.contrib.sites
 > django.contrib.contenttypes
 > django.contrib.sessions
 > django.contrib.admin
 > django.contrib.admindocs
 > django.contrib.flatpages
 > src.web.news
 > src.web.website
 > south

Not synced (use migrations):
 - src.server
 - src.players
 - src.objects
 - src.comms
 - src.help
 - src.scripts
(use ./manage.py migrate to migrate these)
greyhart@greyhart-ubuntu:~/evennia/game$ python manage.py migrate --traceback

Running migrations for server:
 - Migrating forwards to 0002_fix_config_value.
 > server:0001_rename_config_table_to_server_table
 > server:0002_fix_config_value
 - Loading initial data for server.
Installed 0 object(s) from 0 fixture(s)
Running migrations for players:
 - Migrating forwards to 0019_remove_old_attr_value_field.
 > objects:0001_initial
 > players:0001_initial
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 222, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 255, in execute
    output = self.handle(*args, **options)
  File "/usr/lib/python2.7/dist-packages/south/management/commands/migrate.py", line 105, in handle
    ignore_ghosts = ignore_ghosts,
  File "/usr/lib/python2.7/dist-packages/south/migration/__init__.py", line 191, in migrate_app
    success = migrator.migrate_many(target, workplan, database)
  File "/usr/lib/python2.7/dist-packages/south/migration/migrators.py", line 221, in migrate_many
    result = migrator.__class__.migrate_many(migrator, target, migrations, database)
  File "/usr/lib/python2.7/dist-packages/south/migration/migrators.py", line 292, in migrate_many
    result = self.migrate(migration, database)
  File "/usr/lib/python2.7/dist-packages/south/migration/migrators.py", line 125, in migrate
    result = self.run(migration)
  File "/usr/lib/python2.7/dist-packages/south/migration/migrators.py", line 99, in run
    return self.run_migration(migration)
  File "/usr/lib/python2.7/dist-packages/south/migration/migrators.py", line 81, in run_migration
    migration_function()
  File "/usr/lib/python2.7/dist-packages/south/migration/migrators.py", line 57, in <lambda>
    return (lambda: direction(orm))
  File "/home/greyhart/evennia/src/players/migrations/0001_initial.py", line 41, in forwards
    db.add_column('objects_objectdb', 'db_player', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['players.PlayerDB'], null=True, blank=True))
  File "/usr/lib/python2.7/dist-packages/south/db/sqlite3.py", line 35, in add_column
    field.column: self._column_sql_for_create(table_name, name, field, False),
  File "/usr/lib/python2.7/dist-packages/south/db/sqlite3.py", line 63, in _remake_table
    if indexes[name]['unique'] and name not in uniques_deleted:
KeyError: u'db_key'

The error is always in players:0001_initial, and always the KeyError. The thought occurred to me that it might be an issue with the SECRET_KEY, but I didn't touch it last night, and today I simply ran the commands one after the other, so that really shouldn't be it.

Based on the directory, I'm running python 2.7
I am running Django 1.5.1, which is the latest distro. To upgrade from the version that was originally installed, I went to the Django website, got the tarball, and followed their instructions.

==============================
tar xzvf Django-1.5.1.tar.gz
cd Django-1.5.1
sudo python setup.py install
==============================

The first time I did that, it told me that I overwrote an older version, and that it might cause problems. It also told me to delete the Django folder in /usr/local/lib/python2.7/dist-packages
I deleted both the Django folder and the Django-1.5.1.egg-info file, then reran the install.

One thing I do notice, last night I misread the path, and went to
/usr/lib/python2.7/dist-packages and deleted the Django folder I found there. I realized I was in the wrong directory, went to the correct one and deleted the Django folder there. I figured the reinstall would put everything back as needed.
I do not see the Django folder in/usr/lib/python2.7/dist-packages today.


I haven't used Linux all that much. I haven't played with it since the days of BSD, having GUI as an option, much like Windows 3.1 was.
I've set it up as a dual boot on my Windows 7 machine to play around with this, and the OS.

The section of the base.py that is bombing is:

def run_from_argv(self, argv):
"""
Set up any environment changes requested (e.g., Python path
and Django settings), then run this command. If the
command raises a ``CommandError``, intercept it and print it sensibly
to stderr.
"""
parser = self.create_parser(argv[0], argv[1])
options, args = parser.parse_args(argv[2:])
handle_default_options(options)
try:
self.execute(*args, **options.__dict__)
except Exception as e:
# self.stderr is not guaranteed to be set here
stderr = getattr(self, 'stderr', OutputWrapper(sys.stderr, self.style.ERROR))
if options.traceback:
stderr.write(traceback.format_exc())
else:
stderr.write('%s: %s' % (e.__class__.__name__, e))
sys.exit(1)

Line 222 being the self.execute under the try: (highlighted in blue)


Greyhart

unread,
May 24, 2013, 5:44:42 PM5/24/13
to eve...@googlegroups.com


On Friday, May 24, 2013 1:48:48 PM UTC-6, Xirrin wrote:
I did an install today on 12.04.2 Server and wanted to come up with a standard installation process (with intentions of perhaps writing a script for the community). Here's what I came up with as far as a straight list of instructions that should work from end-to-end in getting set up and running on Ubuntu 12.04.2. The instructions are from a completely clean install of Ubuntu.

...

Just for reference I'm using VirtualBox to run it as a VM with 1024MB RAM, a single CPU core, and 8GB HDD space. It *should* work on both Desktop and Server editions of 12.04 and 12.10, although I've only tested on 12.04.2 Server. If you follow the above instructions it should work though, as it has without fail in my tests. Hopefully this helps!

Xirrin,

I'm running Ubuntu Desktop, not server, but that shouldn't make a difference for your instructions. If I knew how to properly uninstall everything, I would go through and try your instructions. As it is, I'm worried I'll just make things worse by duplicating python, Django, or any of the other packages.

Part of the reason for installing Linux in the first place, was to learn about it. I suspect I will. :)
 

Greyhart

unread,
May 24, 2013, 6:41:56 PM5/24/13
to eve...@googlegroups.com


On Friday, May 24, 2013 1:48:48 PM UTC-6, Xirrin wrote:
I did an install today on 12.04.2 Server and wanted to come up with a standard installation process (with intentions of perhaps writing a script for the community). Here's what I came up with as far as a straight list of instructions that should work from end-to-end in getting set up and running on Ubuntu 12.04.2. The instructions are from a completely clean install of Ubuntu.

Xirrin,

Ok, I took a chance, and followed your instructions, copy & pasting out of your post. Unlike Windows, it seems Ubuntu is smart enough to know when software is current. I saw several messages that the most current version was already installed. I deleted the Evennia directory, and pulled a new copy, pasting your command line.

I copied and pasted the manage.py and manage.py syncdb. Both ran fine. I copied and pasted the manage.py migrate, and got the same error in the same place. I deleted the settings.py and the evennia.db3 files and reran with the traceback just to be sure, and it is the exact same line.

Theoretically, it should work, but I still get the same error. Something in one of my installs is wrong, but I don't know what it is.


Griatch Art

unread,
May 24, 2013, 7:25:31 PM5/24/13
to eve...@googlegroups.com
@Greyhart:

I think your assessment is correct - there is something fishy with your installation of the dependencies.

Note: To uninstall the distro-packaged version of e.g. Django in a debian-derived distro like Ubuntu, you never go and delete files manually. You do "apt-get remove python-django" or "apt-get purge python-django" before installing the latest version using whatever method (you need to be root for this).

You need to also check your version of python-south.

Did you try the virtualenv install I suggested and linked to in my previous post? That will install and use local versions of all dependencies and you don't have to worry about any messed up global distro installs. 
.
Griatch

Andrew

unread,
Jun 27, 2013, 2:16:02 PM6/27/13
to eve...@googlegroups.com
It's been a few days and I've been messing around with a little bit of progress here and there. I wanted to say that this post was of immense use to me. Thank you Xirrin, you got the Linode I purchased up and running with relative ease!


On Friday, May 24, 2013 3:48:48 PM UTC-4, Xirrin wrote:
I did an install today on 12.04.2 Server and wanted to come up with a standard installation process (with intentions of perhaps writing a script for the community). Here's what I came up with as far as a straight list of instructions that should work from end-to-end in getting set up and running on Ubuntu 12.04.2. The instructions are from a completely clean install of Ubuntu.

sudo apt-get update && sudo apt-get upgrade


sudo apt-get install python-dev build-essential mercurial python-twisted python-pip


sudo pip install Django==1.5.1 south (you will see some errors about ‘no previously-included files)


wget http://effbot.org/downloads/Imaging-1.1.7.tar.gz (This will download the tar.gz file into your current directory)


tar xvfz Imaging-1.1.7.tar.gz (Extract the Python Imaging Library [PIL] from the .tar.gz file to its own folder)


cd Imaging-1.1.7 (Change directory to the Imaging folder that we just extracted)


sudo python setup.py install (Run the PIL installation - lots of spam)


cd .. (move back to the previous folder)


hg clone https://code.google.com/p/evennia/ evennia (the “evennia” argument at the end is the folder that you will download to. change this as needed)


cd evennia/game (move into the evennia folder, or change it to the folder you set)


python manage.py


python manage.py syncdb (set up your account here)


python manage.py migrate (more spam)


python evennia.py -i start (start the server - the first time it will start, stop, then start again)


(whenever you’re done) python evennia.py stop

Ethan Hussong

unread,
Jul 1, 2013, 5:29:36 PM7/1/13
to eve...@googlegroups.com
Awesome! Thanks so much for letting me know and glad that you got it working!


--
--
You received this message because you are subscribed to the "Evennia" MU* server mailing list.
To post to this group, send email to eve...@googlegroups.com (or use the web interface).
To unsubscribe from this group, send email to evennia+u...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/evennia?hl=en
 
---
You received this message because you are subscribed to a topic in the Google Groups "Evennia" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/evennia/N5ZO0QIwDQk/unsubscribe.

To unsubscribe from this group and all its topics, send an email to evennia+u...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Ethan Hussong :: protocol.by/ehussong

Griatch Art

unread,
Jul 2, 2013, 8:24:38 AM7/2/13
to eve...@googlegroups.com
Glad things worked out. :)

.
Griatch

On Friday, May 24, 2013 9:55:35 AM UTC+2, Greyhart wrote:
I've spent the last few days looking for something to use on my website, to encourage community and fun. I think Evennia is it.

Now my problem:

I wanted to set up a local version of Evennia to play with, so I downloaded and installed Ubuntu 12.04.2

I then used the suggested command
apt-get install python python-django python-twisted mercurial python-django-
south

to pull down all the required files. I found that it pulls down an older version of Django, which isn't supported for this install, so I downloaded v1.5.1 and installed it.

I went through a smooth install until I got to python manage.py migrate.
Now I had originally copied and pasted the SERVERNAME = into settings.py and changed it. I also copied/pasted the TIME_ZONE and changed it from 'UTC' to 'MST7MDT' for Denver.

The migrate command gave me the following:

Running migrations for server:
- Migrating forwards to 0002_fix_config_value.
> server:0001_rename_config_table_to_server_table
> server:0002_fix_config_value
- Loading initial data for server.
Installed 0 object(s) from 0 fixture(s)
Running migrations for players:
- Migrating forwards to 0019_remove_old_attr_value_field.
> objects:0001_initial
> players:0001_initial

Greymtr Smith

unread,
Nov 21, 2013, 8:48:03 PM11/21/13
to eve...@googlegroups.com
Hello,

I'm a bit new to Evennia , so I decided to go along with the Getting Started instructions. I haven't made any changes to the settings.py file or any other file , yet when I run python manage.py migrate I receive the KeyError: u'db_key' error. I followed all the methods mentioned on this thread ( which is very , very helpful ) , yet the problem is not solved...

The output seems to be the same as Greyharts and gets stuck at  players:0001_initial .

I have re-installed all the requirements , deleted the evennia.db3 and settings.py files , despite this I still get the error.

I'm running 12.04 Server Edition of Ubuntu , any ideas how to solve the error ?

Griatch Art

unread,
Nov 23, 2013, 2:48:52 AM11/23/13
to eve...@googlegroups.com
Hi there,

It seems there is a bug in South 0.8.3 (just a week old or so). It's supposed to the fixed sometime soon (hopefully in the next week). Use a virtualenv and try South 0.8.2. Also, the main branch of Evennia is not yet updated to fully support Django 1.6 (the dev clone is, but also faces the South issue). So you might want to test with Django 1.5 or 1.4.5 for now. When the South issue is fixed and we merge development into main we should all hopefully be over this temporary incompatabiluty hump. :)
.
Griatch

Greymtr Smith

unread,
Nov 25, 2013, 10:44:17 AM11/25/13
to eve...@googlegroups.com
I don't think South is the problem ... I've been facing this problem for 'bout a month or so.........So we can rule out the South problem.......I think.....

Anyways will try running Evennia on virtualenv......Will see how that works out.....

Griatch Art

unread,
Dec 3, 2013, 2:38:29 AM12/3/13
to eve...@googlegroups.com
@Greymtr Smith

The dev-branch merged into main now, so you should try to pull and migrate to the latest version. If still doesn't work, try with a virtualenv too. Let us know how it goes!
.
Griatch
Reply all
Reply to author
Forward
Message has been deleted
0 new messages