In the Django 1.7 documentation, it is stated that the Django user must have a number of CREATE privileges in order to use the new python manage.py migrate command. This obviously assumes that the Django project requires writing to the database. What if it doesn't? What if I don't want to use migrate?
I am starting a project where I will be using an Oracle database, but do not intend to give any write privileges to Django. I was surprised to see that I can't run python manage.py runserver even when the project is empty, and I just have a settings.py file. Instead, I get the following error message:
django.db.utils.DatabaseError: ORA-01031: insufficient privileges
How can I work around this?
[EDIT]
Also interesting, if I leave Oracle as the default database and head on to the shell, I can actually make queries normally.
[EDIT 2] Traceback...
[myproject]yourstruly#myserver /projects/django/myproject2 $ python manage.py runserver 0.0.0.0:8001Performing system checks...
System check identified no issues (0 silenced).
Unhandled exception in thread started by <function wrapper at 0x1ce36e0>
Traceback (most recent call last):
File "/projects/.virtualenv/myproject/lib/python2.7/site-packages/django/utils/autoreload.py", line 222, in wrapper
fn(*args, **kwargs)
File "/projects/.virtualenv/myproject/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 107, in inner_run
self.check_migrations()
File "/projects/.virtualenv/myproject/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 159, in check_migrations
executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
File "/projects/.virtualenv/myproject/lib/python2.7/site-packages/django/db/migrations/executor.py", line 17, in __init__
self.loader = MigrationLoader(self.connection)
File "/projects/.virtualenv/myproject/lib/python2.7/site-packages/django/db/migrations/loader.py", line 48, in __init__
self.build_graph()
File "/projects/.virtualenv/myproject/lib/python2.7/site-packages/django/db/migrations/loader.py", line 179, in build_graph
self.applied_migrations = recorder.applied_migrations()
File "/projects/.virtualenv/myproject/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 59, in applied_migrations
self.ensure_schema()
File "/projects/.virtualenv/myproject/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 53, in ensure_schema
editor.create_model(self.Migration)
File "/projects/.virtualenv/myproject/lib/python2.7/site-packages/django/db/backends/schema.py", line 270, in create_model
self.execute(sql, params)
File "/projects/.virtualenv/myproject/lib/python2.7/site-packages/django/db/backends/schema.py", line 98, in execute
cursor.execute(sql, params)
File "/projects/.virtualenv/myproject/lib/python2.7/site-packages/django/db/backends/utils.py", line 81, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "/projects/.virtualenv/myproject/lib/python2.7/site-packages/django/db/backends/utils.py", line 65, in execute
return self.cursor.execute(sql, params)
File "/projects/.virtualenv/myproject/lib/python2.7/site-packages/django/db/utils.py", line 94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/projects/.virtualenv/myproject/lib/python2.7/site-packages/django/db/backends/utils.py", line 65, in execute
return self.cursor.execute(sql, params)
File "/projects/.virtualenv/myproject/lib/python2.7/site-packages/django/db/backends/oracle/base.py", line 916, in execute
return self.cursor.execute(query, self._param_generator(params))
django.db.utils.DatabaseError: OprojectsA-01031: insufficient privileges
Related
I'm trying to make a webpage using python and mezzanine as its cms.
but I got this error after successfully creating Superuser:
Superuser created successfully.
Traceback (most recent call last):
File "C:\Python39\lib\site-packages\django\db\backends\utils.py", line 62, in execute
return self.cursor.execute(sql)
File "C:\Python39\lib\site-packages\django\db\backends\sqlite3\base.py", line 326, in execute
return Database.Cursor.execute(self, query)
sqlite3.OperationalError: no such table: django_site__old
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\annie\Documents\DMCproject\manage.py", line 14, in <module>
execute_from_command_line(sys.argv)
File "C:\Python39\lib\site-packages\django\core\management\__init__.py", line 364, in execute_from_command_line
utility.execute()
File "C:\Python39\lib\site-packages\django\core\management\__init__.py", line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python39\lib\site-packages\django\core\management\base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Python39\lib\site-packages\django\core\management\base.py", line 330, in execute
output = self.handle(*args, **options)
File "C:\Python39\lib\site-packages\mezzanine\core\management\commands\createdb.py", line 61, in handle
func()
File "C:\Python39\lib\site-packages\mezzanine\core\management\commands\createdb.py", line 109, in create_pages
call_command("loaddata", "mezzanine_required.json")
File "C:\Python39\lib\site-packages\django\core\management\__init__.py", line 131, in call_command
return command.execute(*args, **defaults)
File "C:\Python39\lib\site-packages\django\core\management\base.py", line 330, in execute
output = self.handle(*args, **options)
File "C:\Python39\lib\site-packages\django\core\management\commands\loaddata.py", line 69, in handle
self.loaddata(fixture_labels)
File "C:\Python39\lib\site-packages\django\core\management\commands\loaddata.py", line 115, in loaddata
connection.check_constraints(table_names=table_names)
File "C:\Python39\lib\site-packages\django\db\backends\sqlite3\base.py", line 276, in check_constraints
cursor.execute(
File "C:\Python39\lib\site-packages\django\db\backends\utils.py", line 79, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "C:\Python39\lib\site-packages\django\db\backends\utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "C:\Python39\lib\site-packages\django\db\utils.py", line 94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "C:\Python39\lib\site-packages\django\utils\six.py", line 685, in reraise
raise value.with_traceback(tb)
File "C:\Python39\lib\site-packages\django\db\backends\utils.py", line 62, in execute
return self.cursor.execute(sql)
File "C:\Python39\lib\site-packages\django\db\backends\sqlite3\base.py", line 326, in execute
return Database.Cursor.execute(self, query)
django.db.utils.OperationalError: Problem installing fixtures: no such table: django_site__old
This is related to this issue in Django: https://code.djangoproject.com/ticket/29182.
It is caused by a new behavior introduced in sqlite 3.26.
Django has patched it in latest 2.0 and 2.1, but mezzanine does not support Django 2 yet.
The easiest fix is to not use sqlite - switch to postgres, mysql, etc. Alternatively, downgrade sqlite to < 3.26
https://github.com/stephenmcd/mezzanine/issues/1910
I had the same issue in a github action and I had to tweak the ubuntu version to get the preinstalled sqlite version that would work. What fixed the issue for me was to change this line:
runs-on: ubuntu-latest
to
runs-on: ubuntu-18.04
Got the ubuntu version containing the sqlite version I needed here: https://packages.ubuntu.com/search?keywords=sqlite3.
I started Kiwi TCMS in Docker (k8s) with Postgresql. It started ok, but when I wanted to run migrations it crashed. I used this docker-compose for inspiration.
Log shows problem with connection with MySQL. But I changed configuration for engine. See:
bash-4.2$ KIWI_DB_ENGINE=django.db.backends.postgresql_psycopg2 /Kiwi/manage.py migrate
django.db.backends.postgresql_psycopg2
Traceback (most recent call last):
File "/venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 216, in ensure_connection
self.connect()
File "/venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 194, in connect
self.connection = self.get_new_connection(conn_params)
File "/venv/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 227, in get_new_connection
return Database.connect(**conn_params)
File "/venv/lib/python3.6/site-packages/MySQLdb/__init__.py", line 85, in Connect
return Connection(*args, **kwargs)
File "/venv/lib/python3.6/site-packages/MySQLdb/connections.py", line 204, in __init__
super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (2013, "Lost connection to MySQL server at 'reading initial communication packet', system error: 0")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Kiwi/manage.py", line 13, in <module>
execute_from_command_line(sys.argv)
File "/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/venv/lib/python3.6/site-packages/django/core/management/base.py", line 316, in run_from_argv
self.execute(*args, **cmd_options)
File "/venv/lib/python3.6/site-packages/django/core/management/base.py", line 350, in execute
self.check()
File "/venv/lib/python3.6/site-packages/django/core/management/base.py", line 379, in check
include_deployment_checks=include_deployment_checks,
File "/venv/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 59, in _run_checks
issues = run_checks(tags=[Tags.database])
File "/venv/lib/python3.6/site-packages/django/core/checks/registry.py", line 71, in run_checks
new_errors = check(app_configs=app_configs)
File "/venv/lib/python3.6/site-packages/django/core/checks/database.py", line 10, in check_database_backends
issues.extend(conn.validation.check(**kwargs))
File "/venv/lib/python3.6/site-packages/django/db/backends/mysql/validation.py", line 9, in check
issues.extend(self._check_sql_mode(**kwargs))
File "/venv/lib/python3.6/site-packages/django/db/backends/mysql/validation.py", line 13, in _check_sql_mode
with self.connection.cursor() as cursor:
File "/venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 255, in cursor
return self._cursor()
File "/venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 232, in _cursor
self.ensure_connection()
File "/venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 216, in ensure_connection
self.connect()
File "/venv/lib/python3.6/site-packages/django/db/utils.py", line 89, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 216, in ensure_connection
self.connect()
File "/venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 194, in connect
self.connection = self.get_new_connection(conn_params)
File "/venv/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 227, in get_new_connection
return Database.connect(**conn_params)
File "/venv/lib/python3.6/site-packages/MySQLdb/__init__.py", line 85, in Connect
return Connection(*args, **kwargs)
File "/venv/lib/python3.6/site-packages/MySQLdb/connections.py", line 204, in __init__
super(Connection, self).__init__(*args, **kwargs2)
django.db.utils.OperationalError: (2013, "Lost connection to MySQL server at 'reading initial communication packet', system error: 0")
Any ideas where can be problem please?
bash-4.2$ KIWI_DB_ENGINE=django.db.backends.postgresql_psycopg2 /Kiwi/manage.py migrate
django.db.backends.postgresql_psycopg2
This is setting an environment variable inside the docker container and I'm not sure if that works or which one takes precendece.
If you want somebody to help you post the entire docker-compose.yml (or whatever kubernetes control file you use). Clearly the application thinks it is configured to talk to MySQL and fails when MySQL isn't available.
So problem was with version of used docker image.
I used docker image tag kiwitcms/kiwi:6.2 and I thought it's the latest release. But it's not. This version(docker image) doesn't have code for changing DB engine. I changed version of docker tag to latest and it works pretty well now.
I have a Django project I've been developing locally for a while. It works fine on my local machine, and I am using a customuser setup so that my login auth only needs email / password, as opposed to the default Django user table which needs email / username / password.
I just got my project hosted on Heroku, and can see the webpage UI get loaded fine. But I'm getting Django errors when clicking any links, and think its connected to an issue when I try to run
heroku run python manage.py migrate
I'm trying to run this on heroku to setup the DB, but when I do so I get an error saying:
Running python manage.py migrate on ⬢ songsweeper... up, run.1353 (Free)
Operations to perform:
Apply all migrations: account, admin, auth, contenttypes, playlist, sessions, sites
Running migrations:
Applying account.0001_initial...Traceback (most recent call last):
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
psycopg2.errors.UndefinedTable: relation "users_customuser" does not exist
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/base.py", line 364, in execute
output = self.handle(*args, **options)
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/base.py", line 83, in wrapped
res = handle_func(*args, **kwargs)
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 234, in handle
fake_initial=fake_initial,
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/migrations/executor.py", line 117, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/migrations/executor.py", line 247, in apply_migration
migration_recorded = True
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 110, in __exit__
self.execute(sql)
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 137, in execute
cursor.execute(sql, params)
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/backends/utils.py", line 99, in execute
return super().execute(sql, params)
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/utils.py", line 89, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "users_customuser" does not exist
My project is very large, but to give an overview of where I'm defining customuser, it appears in these places:
Does anyone have any advice on how to fix this migration error? Or is it indicative or something alrger? The 'sign-in' link on my site leads to a different error saying "relation "django_site" does not exist", but I think it has something to do with this failed customuser error.
I am currently using the default sqlite3 db.
I faced the problem similar to yours before.
In my opinion, I think it is because of a migration file in the user app.
So you will have to do migrate the user model.
$ python manage.py makemigrations users
$ python manage.py migrate
I resolved the problem using the above way.
I'm working on a website which allows users to nominate and vote for different positions. I use Python 2.7 and Django 1.10. The position objects were added through django's admin interface on the actual server. Therefore, my local server is empty of any positions. I wanted to add the positions to my local server for the sake of development. I ran the command python manage.py dumpdata voting.Position --=2 > voting/fixtures/default_positions.json.
The fixture has been made, and now I want to loaddata. When I run python manage.py loaddata voting/fixtures/default_positions.json (on my local dir. not the website's/server's one), I get the following error:
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 359, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 305, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 356, in execute
output = self.handle(*args, **options)
File "/usr/lib/python2.7/site-packages/django/core/management/commands/loaddata.py", line 64, in handle
self.loaddata(fixture_labels)
File "/usr/lib/python2.7/site-packages/django/core/management/commands/loaddata.py", line 104, in loaddata
self.load_label(fixture_label)
File "/usr/lib/python2.7/site-packages/django/core/management/commands/loaddata.py", line 167, in load_label
obj.save(using=self.using)
File "/usr/lib/python2.7/site-packages/django/core/serializers/base.py", line 201, in save
models.Model.save_base(self.object, using=using, raw=True, **kwargs)
File "/usr/lib/python2.7/site-packages/django/db/models/base.py", line 824, in save_base
updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
File "/usr/lib/python2.7/site-packages/django/db/models/base.py", line 889, in _save_table
forced_update)
File "/usr/lib/python2.7/site-packages/django/db/models/base.py", line 939, in _do_update
return filtered._update(values) > 0
File "/usr/lib/python2.7/site-packages/django/db/models/query.py", line 652, in _update
return query.get_compiler(self.db).execute_sql(CURSOR)
File "/usr/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 1148, in execute_sql
cursor = super(SQLUpdateCompiler, self).execute_sql(result_type)
File "/usr/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 835, in execute_sql
cursor.execute(sql, params)
File "/usr/lib/python2.7/site-packages/django/db/backends/utils.py", line 79, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "/usr/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/usr/lib/python2.7/site-packages/django/db/utils.py", line 94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/usr/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/usr/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 337, in execute
return Database.Cursor.execute(self, query, params)
django.db.utils.DatabaseError: Problem installing fixture '/home/Saleha/trabd/voting/fixtures/default_positions.json': Could not load voting.Position(pk=1): file is encrypted or is not a database
The fixture file: https://pastebin.com/avRzHQyf (too long for this place)
I need to say, as well, that python manage.py runserver doesn't work, nor does python manage.py makemigrations; and all that happens is that this same error pops up.
If no solution, could someone at least guide me to how to undo the loaddata command, so at least I can get my local server running I again?
I apologize for the long introduction, but I'm relatively new to programming and thought I should explain as much as I can. My error could be in the simplest and silliest of places.
Any help is appreciated. Thank you in advance.
I am unable to run makemigrations, migrate, or anything else (flush, reset_db from django-extensions) if I have a certain app in my INSTALLED_APPS.
The app is called issues and has one model:
class Issue(models.Model):
title = models.CharField(max_length=255)
description = models.CharField(max_length=1000)
sent = models.BooleanField()
And it was working before (makemigrations and migrate ran fine and I could use the app/model correctly), until I tried adding:
severity = models.IntegerField()
and tried to run makemigrations. I don't have the error or remember it anymore, but since then everything is broken, even after removing severity from the model.
Everything works if I remove the issues app from my settings.py.
The error I get:
madjura#madjura-E6228:~/workspace/budget/src$ python3.5 manage.py makemigrationsTraceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python3.5/dist-packages/django/db/backends/sqlite3/base.py", line 337, in execute
return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: no such table: issues_issue
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.5/dist-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.5/dist-packages/django/core/management/__init__.py", line 341, in execute
django.setup()
File "/usr/local/lib/python3.5/dist-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python3.5/dist-packages/django/apps/registry.py", line 115, in populate
app_config.ready()
File "/home/madjura/workspace/budget/src/issues/apps.py", line 16, in ready
issues.models.Issue.objects.check_and_send_unsent_issues()
File "/home/madjura/workspace/budget/src/issues/models.py", line 18, in check_and_send_unsent_issues
for issue in issues:
File "/usr/local/lib/python3.5/dist-packages/django/db/models/query.py", line 256, in __iter__
self._fetch_all()
File "/usr/local/lib/python3.5/dist-packages/django/db/models/query.py", line 1087, in _fetch_all
self._result_cache = list(self.iterator())
File "/usr/local/lib/python3.5/dist-packages/django/db/models/query.py", line 54, in __iter__
results = compiler.execute_sql()
File "/usr/local/lib/python3.5/dist-packages/django/db/models/sql/compiler.py", line 835, in execute_sql
cursor.execute(sql, params)
File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py", line 79, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python3.5/dist-packages/django/db/utils.py", line 94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/usr/local/lib/python3.5/dist-packages/django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python3.5/dist-packages/django/db/backends/sqlite3/base.py", line 337, in execute
return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: no such table: issues_issue
While issues is in INSTALLED_APPS I get the same error when running migrate, flush and reset_db.
I have tried running flush and reset_db with issues removed from INSTALLED_APPS, this did not solve the problem.
I have tried doing the above and then running makemigrations and migrate, this does also not work. As soon as I put issues back in INSTALLED_APPS everything is broken.
How can I fix this?
EDIT:
Maybe relevant, the issue model has a Manager with a function:
class IssueManager(models.Manager):
"""Manager for the Issue class."""
def check_and_send_unsent_issues(self):
"""
Checks for unsent Issue objects (Issue.sent = False) and attempts
to send them.
Issues that have been sent are deleted.
If the issue fails to be sent for whatever reason, it is not deleted.
Does nothing if there are no unsent issues.
This method is called once when the server starts.
"""
issues = self.get_queryset().filter(sent=False)
for issue in issues:
try:
make_issue(issue.title, issue.description)
issue.delete()
except PostIssueException:
pass
Using apps.py I check for unsent issues and post them on Gitlab.
EDIT 2:
Issue resolved by commenting the line below which appears in my apps.py, in ready():
issues.models.Issue.objects.check_and_send_unsent_issues()
Which somehow caused things to break, I don't understand why. Could someone explain that please?
Try moving the line import issues.models into def ready() to prevent loading the models too early.