Comments (8)
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.
from django-prometheus.
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
from django-prometheus.
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
from django-prometheus.
Just wondering whether there is an update on this? Perhaps a more elegant fix?
from django-prometheus.
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'
from django-prometheus.
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
from django-prometheus.
Just hit the same issue. Fixed as shown above.
from django-prometheus.
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:
- Django 2.1.7
- Python 3.6.7
- django-prometheus 1.0.15
- prometheus-client 0.6.0
- django-simple-history 2.7.0 (only mentioned because it has caused a couple of other migration issues for me)
from django-prometheus.
Related Issues (20)
- Histogram of requests processing time does not honor PROMETHEUS_LATENCY_BUCKETS
- Supporting Django 4.1 HOT 2
- Cannot see exemplars in the metrics
- It prevents application from resolving DB URL HOT 2
- Custom metric does not work HOT 4
- Wrong Metrics being published
- 'Counter' object has no attribute '_value' HOT 2
- Support for Django 4.2 and Psycopg3 HOT 5
- django_migrations_unapplied_total = 1 but no migrations are unapplied HOT 2
- RedisCache not working
- Exclude metrics by view (or other criteria) HOT 2
- Move to psycopg3 HOT 1
- Custom namespace HOT 1
- RAM keeps going up when scraping metrics
- Unable to monitor a database | django_prometheus.db.backends is not an available backend HOT 2
- PrometheusEndpointServer throws an exception, after which the endpoint is not available and not restart
- django_http_requests_before_middlewares_total,Shouldn't this indicator be a line that keeps rising? HOT 3
- django_http_requests_latency_seconds_by_view_method_bucket wrong calculation
- unnamed view / 404 for Django > 4.1 versions HOT 2
- New release HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-prometheus.