Skip to content
Fraser Harris edited this page Mar 24, 2015 · 13 revisions

=== ##Table of Contents

  1. ImportError: Could not import settings 'secondfunnel.settings.dev'
  2. python manage.py only shows django options
  3. Deployment to ElasticBeanstalk Failed
  4. I can't ssh into the instance
  5. I SSHed into an instance but all I see is t.sh
  6. I can't find the database password
  7. src/crypto/x509.h:17:25: error: openssl/ssl.h: No such file or directory
  8. Database is locked
  9. Table has no column _____

=== ###Import Error Description: The SecondFunnel python environment is not active, so it can't import the project settings; can't find the project python files.

Solution: Run workon SecondFunnel in the command-line. If you get an error about workon not being defined, make sure you run source /usr/local/bin/virtualenvwrapper.sh.

=== ###Only Django options are showing. Description: This occurs when the settings file isn't loaded. One cause of this is that your DJANGO_SETTINGS_MODULE environment variable is already set to an incorrect value.

Solution: Use unset DJANGO_SETTINGS_MODULE to allow manage.py to set its value.

=== ###Deployment to Elastic BeanStalk Failed

Example

- Migrating forwards to 0012_auto__add_genericimage.
> assets:0011_auto__add_field_product_sku__del_field_productmedia_media_type__chg_fi
! Error found during real run of migration! Aborting.

! Since you have a database that does not support running
! schema-altering statements in transactions, we have had 
! to leave it in an interim state between migrations.

! You *might* be able to recover with: ...

This almost certainly means that some of your migrations are out of order. This happens because migrations are numbered, but also have accompanying text, so git won't detect a merge conflict if there are duplicate numbered conflicts. For example

pinpoint/migrations
- ...
- 0010_auto__del_some_column.py
- 0010_auto__add_some_other_conflicting_thing.py

You may think that you can just re-order the migrations. Nope. Because we use RDS, migrations are left in a bad state, and something like this will occur after you do that:

 ! These migrations are in the database but not on disk:
     <assets: 0010_auto__add_genericmedia>
 ! I'm not trusting myself; either fix this yourself by fiddling
 ! with the south_migrationhistory table, or pass --delete-ghost-migrations
 ! to South to have it delete ALL of these records (this may not be good).

In this case, you'll have no choice but to go into the south_migrationhistory table in the database, and:

  • Rename your missing migration to the new one
  • Figure out what the last successful migration was, and remove any migrations after that

This is a tricky process, so in general be aware of the migrations before deploying.

=== ###Can't SSH into Instance Solution:

1. Make sure your public key is in [this file](https://github.com/Willet/SecondFunnel/blob/dev/ssh_keys)
2. Make sure the key is actually deployed to the instance
3. Make sure you are sshing as `ec2-user`

=== ###Only t.sh in Instance Solution: You have to cd somewhere else, documented here.

=== ###Can't find Database Password Solution: Run vi /opt/python/current/env on one of the master instances. The password should be called RDS_PASSWORD.

=== ###OpenSSL, no such file or directory Solution: Ubuntu 13.xx and up requires OpenSSL headers to be installed

=== ###Database is Locked, SQLite Description: While running the Django server, page(s) may take a long time to load and/or eventually end with an error saying "Database is Locked". This is because SQLite is designed to be a lightweight database backend and particularly if you're running Celery workers, the number of concurrent operations taking place is to much for it to handle.

Solution: One of

  • Switch to a different backend (e.g. MySQL).
  • Restart/stop the celery workers.

=== ###Table has no column _____ Description: When trying to access a page or model, you get an error message that table has no column with name ___. This means a model was most likely changed.

Solution: Run python manage.py migrate to bring your database up to date.

===

Clone this wiki locally