Sketchy502 / SDV-Summary

An application to display a summary of the player from a Stardew Valley save file.
206 stars 21 forks source link

manage.py crashes #46

Open eirism opened 5 years ago

eirism commented 5 years ago

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?

cheshire137 commented 5 years ago

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'
Sketchy502 commented 5 years ago

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.