Vinyll's blog

( Python, Javascript & Web stuff… )

AMO and Zamboni gotchas


Dev test: It's a copy of the prod to play around.

Change a user's password

A user is a django.contrib.auth.models.User instance. It actually has a password field and a set_password() method. Don't use them.

Instead call the user_instance.get_profile().set_pasword() method then save it. It is actually an instance of users.models.UserProfile that redefines set_password() and other methods.

Gain access as admin

Run some sql command to gain admin access:

./ dbshell
select id from users where email = 'MY_EMAIL_ADDRESS' into @id;
update auth_user set is_superuser = 1, is_staff = 1 where id = @id; insert into groups_users (group_id, user_id) values (1, @id);

(Thanks cvan!)

You can then access the django admin at http://localhost:8000/admin/models/ or an addons admin at http://localhost:8000/admin


Running tests

Make sure to carefully read the doc at

I had test failing and lots of logs. The magical sentence for me was FORCE_DB=1 python test --logging-clear-handlers --noinput

Avoid using FORCE_DB=1 whenever you can though as it is time consuming.

Skipped tests

Search tests - among others - are based on ElasticSearch which is disabled by default. If you need to run search tests, you should install ES, run it and update your settings_local adding RUN_ES_TESTS = True

Writing tests

assertTrue, assertEqual and some other TestCase methods are not used. eq_() and assert are preferred (don't ask me why).

Dealing with translations

.po and .mo files are auto-generated using Wil's Tower project. That means you are not supposed to edit them at all.

Quick code tips

hidden features

launch ./ Read all the available commands. is a shortcut for

Best practices (or how to be picky)




Other projects

FlightDeck gotchas

EDIT: Don't edit this project at all.

I resolved this error: ImportError: Could not import settings 'src.settings_local' (Is it on sys.path?): No module named settings_local

By commenting #import log_settings in the end of file.

Weirdly the server can now start and if I edit the file again and uncomment it, the server reloads just fine.


The project is called Fireplace and the sources are in an individual project.

You may consider this page to run the Marketplace with Zamboni. Note that both fireplace and AMO should be running when you call the Nginx url or you'll get an Nginx 502 bad gateway error.

Note that Zamboni should run with --settings=settings_local_mkt to run the marketplace through nginx!


TypeError: _cache_key() takes exactly 2 arguments (3 given)

Some package may have changed and generate a cache key error. Just run pip install -r requirements/local.txt.

Extra resources

Extra TODOs

Register at

By vinyll on Sept. 26, 2013