migrations: Only don't import "migrate" if it's not available

* mediagoblin/db/migrations.py: Import migrate if available; if not
  print a warning.
This commit is contained in:
Christopher Allan Webber 2016-03-29 09:44:34 -07:00
parent dcccf654f5
commit e47ed5c81c

View File

@ -14,13 +14,21 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import print_function
import datetime import datetime
import uuid import uuid
import six import six
if six.PY2: try:
import migrate import migrate
except ImportError:
# Apparently sqlalchemy-migrate is not installed, so we assume
# we must not need it
# TODO: Better error handling here, or require sqlalchemy-migrate
print("sqlalchemy-migrate not found... assuming we don't need it")
print("I hope you aren't running the legacy migrations!")
import pytz import pytz
import dateutil.tz import dateutil.tz