graphite-web icon indicating copy to clipboard operation
graphite-web copied to clipboard

No module named graphite.settings

Open zhaojigang opened this issue 10 years ago • 14 comments

hi, I used "PYTHONPATH=$GRAPHITE_ROOT/webapp django-admin.py migrate --settings=graphite.settings --run-syncdb" to set up a new database, but the terminal show some error:

Traceback (most recent call last): File "/usr/local/bin/django-admin.py", line 5, in management.execute_from_command_line() File "/Library/Python/2.7/site-packages/django/core/management/init.py", line 367, in execute_from_command_line utility.execute() File "/Library/Python/2.7/site-packages/django/core/management/init.py", line 316, in execute settings.INSTALLED_APPS File "/Library/Python/2.7/site-packages/django/conf/init.py", line 53, in getattr self._setup(name) File "/Library/Python/2.7/site-packages/django/conf/init.py", line 41, in _setup self._wrapped = Settings(settings_module) File "/Library/Python/2.7/site-packages/django/conf/init.py", line 97, in init mod = importlib.import_module(self.SETTINGS_MODULE) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/init.py", line 37, in import_module import(name) ImportError: No module named graphite.settings

I'm a little confused, can you explain why??

zhaojigang avatar Sep 28 '16 12:09 zhaojigang

Have you found the solution?

yarons avatar Feb 07 '17 07:02 yarons

For anyone else running into this, try running it without the PYTHONPATH variable to make sure it isn't an issue with the PATH. Find the settings file location and run from there e.g. cd /opt/graphite/webapp/graphite

then

django-admin.py migrate --settings=graphite.settings --run-syncdb

shammy12 avatar Mar 11 '17 00:03 shammy12

good call shammy12.

makarczyk avatar Apr 07 '17 20:04 makarczyk

I still get the following error

ubuntu@ip-172-31-27-43:/opt/graphite/webapp/graphite$ django-admin.py migrate --settings=graphic.settings --run-syncdb Traceback (most recent call last): File "/usr/local/bin/django-admin.py", line 5, in management.execute_from_command_line() File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 353, in execute_from_command_line utility.execute() File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 302, in execute settings.INSTALLED_APPS File "/usr/local/lib/python2.7/dist-packages/django/conf/init.py", line 55, in getattr self._setup(name) File "/usr/local/lib/python2.7/dist-packages/django/conf/init.py", line 43, in _setup self._wrapped = Settings(settings_module) File "/usr/local/lib/python2.7/dist-packages/django/conf/init.py", line 99, in init mod = importlib.import_module(self.SETTINGS_MODULE) File "/usr/lib/python2.7/importlib/init.py", line 37, in import_module import(name) ImportError: No module named graphic.settings

saifromeo avatar Nov 18 '17 08:11 saifromeo

Dublicate of #1867. @saifromeo : Try to run

cd /opt/graphite/webapp/
PYTHONPATH=/opt/graphite/webapp django-admin.py migrate --settings=graphite.settings --run-syncdb

deniszh avatar Nov 18 '17 23:11 deniszh

This is hitting me also. All the graphite releases since 1.0.0 are giving me this error.

cixelsyd avatar Apr 19 '18 19:04 cixelsyd

A bit more information: I'm installing on Centos7 into a python2.7 virtualenv. it doesnt matter which of the 1.x.y series releases I install from github, I always receive the "ImportError: No module named graphite.settings" that OP reports. It doesnt matter if i activate my virtualenv first, and it doesnt matter if I prefix my command with "PYTHONPATH=/opt/graphite/webapp", or if I cd into my /opt/graphite/webapp/graphite/ directory and run from there. I always receive this:

Traceback (most recent call last):
  File "/opt/graphite/bin/django-admin.py", line 5, in <module>
    management.execute_from_command_line()
  File "/opt/graphite/lib/python2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
    utility.execute()
  File "/opt/graphite/lib/python2.7/site-packages/django/core/management/__init__.py", line 302, in execute
    settings.INSTALLED_APPS
  File "/opt/graphite/lib/python2.7/site-packages/django/conf/__init__.py", line 55, in __getattr__
    self._setup(name)
  File "/opt/graphite/lib/python2.7/site-packages/django/conf/__init__.py", line 43, in _setup
    self._wrapped = Settings(settings_module)
  File "/opt/graphite/lib/python2.7/site-packages/django/conf/__init__.py", line 99, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named graphite.settings

The command I am attempting is:

PYTHONPATH=/opt/graphite/webapp /opt/graphite/bin/django-admin.py migrate auth --settings=graphite.settings --noinput

PYTHONPATH=/opt/graphite/webapp /opt/graphite/bin/django-admin.py migrate --settings=graphite.settings --noinput --run-syncdb

cixelsyd avatar Apr 19 '18 20:04 cixelsyd

I suspecting it's because of some Centos-specific things but I have no idea which things exactly...

deniszh avatar Apr 19 '18 22:04 deniszh

which version of Django are you trying, @cixelsyd ?

deniszh avatar Apr 19 '18 22:04 deniszh

I tried both 1.8 and 1.11 and they both exhibited the same behavior.

cixelsyd avatar Apr 19 '18 22:04 cixelsyd

Just tried it on a quite clean centos7 and it just works for me. Are you sure you cd into the correct directory?

yum install python-virtualenv libffi-devel python-devel gcc
virtualenv /opt/venv
source /opt/venv/bin/activate
pip install -U setuptools
pip install -U carbon
pip install -U graphite-web
cd /opt/graphite/webapp
PYTHONPATH=/opt/graphite/webapp/ django-admin migrate --settings=graphite.settings --run-syncdb

piotr1212 avatar Apr 20 '18 08:04 piotr1212

thank you very much for your efforts, i will verify today or this weekend and post my results.

mobile

On Apr 20, 2018, at 4:56 AM, Piotr Popieluch [email protected] wrote:

Just tried it on a quite clean centos7 and it just works for me. Are you sure you cd into the correct directory?

yum install python-virtualenv libffi-devel python-devel gcc virtualenv /opt/venv source /opt/venv/bin/activate pip install -U setuptools pip install -U carbon pip install -U graphite-web cd /opt/graphite/webapp PYTHONPATH=/opt/graphite/webapp/ django-admin migrate --settings=graphite.settings --run-syncdb — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

cixelsyd avatar Apr 20 '18 13:04 cixelsyd

Seems the same problem at Ubuntu 18.04

I installed graphite with this tutorial https://www.christian-klemm.de/icingaweb2-graphite-modul/ At the point "sudo graphite-manage syncdb " I get the following errors:

root@icinga2:/# sudo graphite-manage syncdb Traceback (most recent call last): File "/usr/bin/graphite-manage", line 15, in execute_from_command_line(sys.argv) File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 443, in execute_from_command_line utility.execute() File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 382, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 196, in run_from_argv self.execute(*args, **options.dict) File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 231, in execute self.validate() File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 266, in validate num_errors = get_validation_errors(s, app) File "/usr/local/lib/python2.7/dist-packages/django/core/management/validation.py", line 30, in get_validation_errors for (app_name, error) in get_app_errors().items(): File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 158, in get_app_errors self._populate() File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 64, in _populate self.load_app(app_name, True) File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 88, in load_app models = import_module('.models', app_name) File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module import(name) File "/usr/lib/python2.7/dist-packages/graphite/dashboard/models.py", line 3, in from graphite.util import json File "/usr/lib/python2.7/dist-packages/graphite/util.py", line 38, in from graphite.logger import log File "/usr/lib/python2.7/dist-packages/graphite/logger.py", line 87, in log = GraphiteLogger() # import-shared logger instance File "/usr/lib/python2.7/dist-packages/graphite/logger.py", line 40, in init level = logging.INFO, File "/usr/lib/python2.7/dist-packages/graphite/logger.py", line 65, in _config_logger handler = Rotater(log_file, when=when, backupCount=backupCount) File "/usr/lib/python2.7/logging/handlers.py", line 171, in init BaseRotatingHandler.init(self, filename, 'a', encoding, delay) File "/usr/lib/python2.7/logging/handlers.py", line 64, in init logging.FileHandler.init(self, filename, mode, encoding, delay) File "/usr/lib/python2.7/logging/init.py", line 920, in init StreamHandler.init(self, self._open()) File "/usr/lib/python2.7/logging/init.py", line 950, in _open stream = open(self.baseFilename, self.mode) IOError: [Errno 2] No such file or directory: '/usr/lib/python2.7/storage/log/webapp/info.log'

mknornschild avatar Oct 05 '18 06:10 mknornschild

@mknornschild: Looks like a completely different issue to me. Sorry, I can't read German, but looks like your manual is broken somehow. Not sure which version of Graphite is in Ubuntu 18.04 packets, also Django 1.4 is probably too old. We officially recommend to install Graphite from sources or use Docker image.

deniszh avatar Oct 05 '18 08:10 deniszh