Open RatanShreshtha opened 7 years ago
Same error here: Django 2.0.2 django-prometheus 1.0.11 Python 3.6.4
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
utility.execute()
File "/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 347, in execute
django.setup()
File "/venv/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/venv/lib/python3.6/site-packages/django/apps/registry.py", line 120, in populate
app_config.ready()
File "/venv/lib/python3.6/site-packages/django_prometheus/apps.py", line 24, in ready
ExportMigrations()
File "/venv/lib/python3.6/site-packages/django_prometheus/migrations.py", line 46, in ExportMigrations
executor = MigrationExecutor(connections[alias])
File "/venv/lib/python3.6/site-packages/django/db/migrations/executor.py", line 18, in __init__
self.loader = MigrationLoader(self.connection)
File "/venv/lib/python3.6/site-packages/django/db/migrations/loader.py", line 49, in __init__
self.build_graph()
File "/venv/lib/python3.6/site-packages/django/db/migrations/loader.py", line 200, in build_graph
self.load_disk()
File "/venv/lib/python3.6/site-packages/django/db/migrations/loader.py", line 109, in load_disk
migration_module = import_module("%s.%s" % (module_name, migration_name))
File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/code/api/migrations/0001_initial.py", line 10, in <module>
class Migration(migrations.Migration):
File "/code/api/migrations/0001_initial.py", line 42, in Migration
bases=(django_prometheus.models.Mixin, models.Model),
AttributeError: module 'django_prometheus.models' has no attribute 'Mixin'
Has there been any progress made on this issue? I'm currently running into it myself. Django 2.0 django-prometheus==1.0.13 Python 3.6.5
Was able to fix the issue by removing the line import django_prometheus.models
and bases=(django_prometheus.models.Mixin, models.Model),
from all migrations.CreateModel
.
Afterwards I was able to successfully run the migrations.
...
import django_prometheus.models <- remove
migrations.CreateModel(
name='<name>',
fields=[
...
],
options={
'ordering': ['...'],
},
bases=(django_prometheus.models.Mixin, models.Model), <- remove
),
I have no idea whats happening here. Maybe this helps someone. The disadvantage is, that if you recreate your migrations you have to do the procedure again...
I am running on
Django 1.11
django-prometheus 1.0.15
Python 3.6.6
Was able to fix the issue by removing the line
import django_prometheus.models
andbases=(django_prometheus.models.Mixin, models.Model),
from allmigrations.CreateModel
. Afterwards I was able to successfully run the migrations.... import django_prometheus.models <- remove migrations.CreateModel( name='<name>', fields=[ ... ], options={ 'ordering': ['...'], }, bases=(django_prometheus.models.Mixin, models.Model), <- remove ),
I have no idea whats happening here. Maybe this helps someone. The disadvantage is, that if you recreate your migrations you have to do the procedure again...
I am running on
Django 1.11
django-prometheus 1.0.15
Python 3.6.6
I'm doing exactly the same thing right now it's annoying
Just hit the same issue. Fixed as shown above.
Also hit same issue, fixed as above. I did try changing django_prometheus.models.Mixin
to django_prometheus.models.ExportModelOperationsMixin
just in case it was just a naming issue, but that didn't help. This is in a class that inherits from another Django base model; perhaps that's causing issues? This was the first migration after adding the class. I'm using:
I changed the bases=(models.Model, django_prometheus.models.Mixin)
line with bases=(models.Model, django_prometheus.models.ExportModelOperationsMixin('model_name'))
and it worked.
I think there is a bug in the library when it wants to create the migration file.
Just wondering whether there is an update on this? Perhaps a more elegant fix?
I am getting AttributeError: module 'django_prometheus.models' has no attribute 'Mixin' when I try to run python manage.py migrate command, I have followed steps in the README.md file.
I am trying to use Prometheus with django 1.8 Python 3.5.3 Fedora 25.