SDV-Summary icon indicating copy to clipboard operation
SDV-Summary copied to clipboard

manage.py crashes

Open eirism opened this issue 6 years ago • 2 comments

When running manage.py from the root folder I get the following traceback:

Traceback (most recent call last):
  File "./manage.py", line 5, in <module>
    from sdv import app
  File "<root folder>/sdv/__init__.py", line 46, in <module>
    from config import config
ModuleNotFoundError: No module named 'config'

Is it possible that you should import sdv.config instead of config?

eirism avatar Oct 06 '18 20:10 eirism

I got this error running sdv/createadmin.py in macOS using Python 3.6.4:

% python createadmin.py
Traceback (most recent call last):
  File "createadmin.py", line 2, in <module>
    from config import config
ImportError: cannot import name 'config'

cheshire137 avatar Jan 02 '19 18:01 cheshire137

Hey,

To avoid these issues the file config.py should contain a dictionary named config where the keys are the environment names and the values are python classes used to store the configuration variables. The following code segment shows an example of the basic structure for config.py, the required variables can be found in the README and you may also need to set the environment variable SDV_APP_SETTINGS=development.

class DevelopmentConfig():
    DEBUG = True

config = {
    'development': DevelopmentConfig
}

I have also noticed that sometimes there are issues when trying to import local modules, this can sometimes be fixed with some sys.path.insert trickery as seen at the bottom of manage.py or by making sure that the working directory is the root of the application.

If you encounter any other issues, let me know and I'll be happy to help.

Sketchy502 avatar Jan 03 '19 23:01 Sketchy502