not able to create database tables when installing moztrap

51 views
Skip to first unread message

Olga Ryzhikova

unread,
Jul 8, 2015, 5:38:50 PM7/8/15
to moz...@googlegroups.com
I'm trying to install MozTrap on my server, but unfortunately I got stuck on the "Create the database tables" step. When I run "./manage.py syncdb --migrate" the following shows up:

Traceback (most recent call last):

  File "./manage.py", line 19, in <module>

    execute_from_command_line(sys.argv)

  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 399, in execute_from_command_line

    utility.execute()

  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 392, in execute

    self.fetch_command(subcommand).run_from_argv(self.argv)

  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 261, in fetch_command

    commands = get_commands()

  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 107, in get_commands

    apps = settings.INSTALLED_APPS

  File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 54, in __getattr__

    self._setup(name)

  File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 49, in _setup

    self._wrapped = Settings(settings_module)

  File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 128, in __init__

    mod = importlib.import_module(self.SETTINGS_MODULE)

  File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 40, in import_module

    __import__(name)

  File "/var/www/moztrap/moztrap/settings/default.py", line 4, in <module>

    from .local import *

  File "/var/www/moztrap/moztrap/settings/local.py", line 15, in <module>

    "USER": environ.get("root", "XXXXXX"),

NameError: name 'environ' is not defined



In my local.py file I only have the DATABASES section uncommented:


DATABASES = {

     "default": {

         "ENGINE": "django.db.backends.mysql",

         "NAME": "moztrap",

         "USER": environ.get("root", "XXXXXX"),

         "HOST": "", # empty string == localhost

         "PASSWORD": "",

         "STORAGE_ENGINE": "InnoDB",

         "OPTIONS": {

                 "init_command": "SET default_storage_engine=InnoDB",

             },

         }

     }


I'm not sure what I'm missing. Looks like some of the modules are not loaded? Any help is appreciated!

朱晓菲

unread,
Jul 21, 2015, 3:21:27 AM7/21/15
to moz...@googlegroups.com
At the begining of the local.py, add "from os import environ"

在 2015年7月9日星期四 UTC+8上午5:38:50,Olga Ryzhikova写道:
Reply all
Reply to author
Forward
0 new messages