Delete a django application











up vote
0
down vote

favorite












I have an app in my django project that I'd rather do away with. I have removed all models and removed all reference to the app from all other apps but if when I remove the app from my settings.INSTALLED_APPS I get the below error.



Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x0000028F0C408C80>
Traceback (most recent call last):
File "C:UsersChidimmo.virtualenvsfunnshopp-Ze7zokAClibsite-packagesdjangoutilsautoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "C:UsersChidimmo.virtualenvsfunnshopp-Ze7zokAClibsite-packagesdjangocoremanagementcommandsrunserver.py", line 120, in inner_run
self.check_migrations()
File "C:UsersChidimmo.virtualenvsfunnshopp-Ze7zokAClibsite-packagesdjangocoremanagementbase.py", line 442, in check_migrations
executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
File "C:UsersChidimmo.virtualenvsfunnshopp-Ze7zokAClibsite-packagesdjangodbmigrationsexecutor.py", line 18, in __init__
self.loader = MigrationLoader(self.connection)
File "C:UsersChidimmo.virtualenvsfunnshopp-Ze7zokAClibsite-packagesdjangodbmigrationsloader.py", line 49, in __init__
self.build_graph()
File "C:UsersChidimmo.virtualenvsfunnshopp-Ze7zokAClibsite-packagesdjangodbmigrationsloader.py", line 226, in build_graph
self.add_external_dependencies(key, migration)
File "C:UsersChidimmo.virtualenvsfunnshopp-Ze7zokAClibsite-packagesdjangodbmigrationsloader.py", line 191, in add_external_dependencies
parent = self.check_key(parent, key[0])
File "C:UsersChidimmo.virtualenvsfunnshopp-Ze7zokAClibsite-packagesdjangodbmigrationsloader.py", line 174, in check_key
raise ValueError("Dependency on unknown app: %s" % key[0])
ValueError: Dependency on unknown app: service


I want to remove every reference to that app from the database as well as removing it from settings.INSTALLED_APPS.



I performed a search of django docs but couldn't find anything to that effect. All previous solutions I found here on SO relied on sqlclear which is no longer supported by django.



How should I go about it? I'm using Django==2.1.3










share|improve this question






















  • You have model dependences with the app you are trying to delete
    – Gabriel Ben Compte
    Nov 22 at 17:47















up vote
0
down vote

favorite












I have an app in my django project that I'd rather do away with. I have removed all models and removed all reference to the app from all other apps but if when I remove the app from my settings.INSTALLED_APPS I get the below error.



Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x0000028F0C408C80>
Traceback (most recent call last):
File "C:UsersChidimmo.virtualenvsfunnshopp-Ze7zokAClibsite-packagesdjangoutilsautoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "C:UsersChidimmo.virtualenvsfunnshopp-Ze7zokAClibsite-packagesdjangocoremanagementcommandsrunserver.py", line 120, in inner_run
self.check_migrations()
File "C:UsersChidimmo.virtualenvsfunnshopp-Ze7zokAClibsite-packagesdjangocoremanagementbase.py", line 442, in check_migrations
executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
File "C:UsersChidimmo.virtualenvsfunnshopp-Ze7zokAClibsite-packagesdjangodbmigrationsexecutor.py", line 18, in __init__
self.loader = MigrationLoader(self.connection)
File "C:UsersChidimmo.virtualenvsfunnshopp-Ze7zokAClibsite-packagesdjangodbmigrationsloader.py", line 49, in __init__
self.build_graph()
File "C:UsersChidimmo.virtualenvsfunnshopp-Ze7zokAClibsite-packagesdjangodbmigrationsloader.py", line 226, in build_graph
self.add_external_dependencies(key, migration)
File "C:UsersChidimmo.virtualenvsfunnshopp-Ze7zokAClibsite-packagesdjangodbmigrationsloader.py", line 191, in add_external_dependencies
parent = self.check_key(parent, key[0])
File "C:UsersChidimmo.virtualenvsfunnshopp-Ze7zokAClibsite-packagesdjangodbmigrationsloader.py", line 174, in check_key
raise ValueError("Dependency on unknown app: %s" % key[0])
ValueError: Dependency on unknown app: service


I want to remove every reference to that app from the database as well as removing it from settings.INSTALLED_APPS.



I performed a search of django docs but couldn't find anything to that effect. All previous solutions I found here on SO relied on sqlclear which is no longer supported by django.



How should I go about it? I'm using Django==2.1.3










share|improve this question






















  • You have model dependences with the app you are trying to delete
    – Gabriel Ben Compte
    Nov 22 at 17:47













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have an app in my django project that I'd rather do away with. I have removed all models and removed all reference to the app from all other apps but if when I remove the app from my settings.INSTALLED_APPS I get the below error.



Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x0000028F0C408C80>
Traceback (most recent call last):
File "C:UsersChidimmo.virtualenvsfunnshopp-Ze7zokAClibsite-packagesdjangoutilsautoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "C:UsersChidimmo.virtualenvsfunnshopp-Ze7zokAClibsite-packagesdjangocoremanagementcommandsrunserver.py", line 120, in inner_run
self.check_migrations()
File "C:UsersChidimmo.virtualenvsfunnshopp-Ze7zokAClibsite-packagesdjangocoremanagementbase.py", line 442, in check_migrations
executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
File "C:UsersChidimmo.virtualenvsfunnshopp-Ze7zokAClibsite-packagesdjangodbmigrationsexecutor.py", line 18, in __init__
self.loader = MigrationLoader(self.connection)
File "C:UsersChidimmo.virtualenvsfunnshopp-Ze7zokAClibsite-packagesdjangodbmigrationsloader.py", line 49, in __init__
self.build_graph()
File "C:UsersChidimmo.virtualenvsfunnshopp-Ze7zokAClibsite-packagesdjangodbmigrationsloader.py", line 226, in build_graph
self.add_external_dependencies(key, migration)
File "C:UsersChidimmo.virtualenvsfunnshopp-Ze7zokAClibsite-packagesdjangodbmigrationsloader.py", line 191, in add_external_dependencies
parent = self.check_key(parent, key[0])
File "C:UsersChidimmo.virtualenvsfunnshopp-Ze7zokAClibsite-packagesdjangodbmigrationsloader.py", line 174, in check_key
raise ValueError("Dependency on unknown app: %s" % key[0])
ValueError: Dependency on unknown app: service


I want to remove every reference to that app from the database as well as removing it from settings.INSTALLED_APPS.



I performed a search of django docs but couldn't find anything to that effect. All previous solutions I found here on SO relied on sqlclear which is no longer supported by django.



How should I go about it? I'm using Django==2.1.3










share|improve this question













I have an app in my django project that I'd rather do away with. I have removed all models and removed all reference to the app from all other apps but if when I remove the app from my settings.INSTALLED_APPS I get the below error.



Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x0000028F0C408C80>
Traceback (most recent call last):
File "C:UsersChidimmo.virtualenvsfunnshopp-Ze7zokAClibsite-packagesdjangoutilsautoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "C:UsersChidimmo.virtualenvsfunnshopp-Ze7zokAClibsite-packagesdjangocoremanagementcommandsrunserver.py", line 120, in inner_run
self.check_migrations()
File "C:UsersChidimmo.virtualenvsfunnshopp-Ze7zokAClibsite-packagesdjangocoremanagementbase.py", line 442, in check_migrations
executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
File "C:UsersChidimmo.virtualenvsfunnshopp-Ze7zokAClibsite-packagesdjangodbmigrationsexecutor.py", line 18, in __init__
self.loader = MigrationLoader(self.connection)
File "C:UsersChidimmo.virtualenvsfunnshopp-Ze7zokAClibsite-packagesdjangodbmigrationsloader.py", line 49, in __init__
self.build_graph()
File "C:UsersChidimmo.virtualenvsfunnshopp-Ze7zokAClibsite-packagesdjangodbmigrationsloader.py", line 226, in build_graph
self.add_external_dependencies(key, migration)
File "C:UsersChidimmo.virtualenvsfunnshopp-Ze7zokAClibsite-packagesdjangodbmigrationsloader.py", line 191, in add_external_dependencies
parent = self.check_key(parent, key[0])
File "C:UsersChidimmo.virtualenvsfunnshopp-Ze7zokAClibsite-packagesdjangodbmigrationsloader.py", line 174, in check_key
raise ValueError("Dependency on unknown app: %s" % key[0])
ValueError: Dependency on unknown app: service


I want to remove every reference to that app from the database as well as removing it from settings.INSTALLED_APPS.



I performed a search of django docs but couldn't find anything to that effect. All previous solutions I found here on SO relied on sqlclear which is no longer supported by django.



How should I go about it? I'm using Django==2.1.3







django






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 22 at 17:08









Parousia

679821




679821












  • You have model dependences with the app you are trying to delete
    – Gabriel Ben Compte
    Nov 22 at 17:47


















  • You have model dependences with the app you are trying to delete
    – Gabriel Ben Compte
    Nov 22 at 17:47
















You have model dependences with the app you are trying to delete
– Gabriel Ben Compte
Nov 22 at 17:47




You have model dependences with the app you are trying to delete
– Gabriel Ben Compte
Nov 22 at 17:47












1 Answer
1






active

oldest

votes

















up vote
0
down vote













The problem is that your migration files constitute a version history of your project. So if another model once had a ForeignKey to a model in your deleted app, that reference is still in a migration file somewhere as a dependency.



One solution is to squash migrations and then delete the old files once all the databases are up to date. There are also more extreme ways to reset migrations.



If you've already deleted the app it may be too late to use the migrations machinery to fix this, so you may have to go through and edit the migrations by hand. Search the migrations directories for the name of your deleted app.






share|improve this answer





















  • I'll try your suggestion and see how I can remove references to it from my migrations
    – Parousia
    Nov 22 at 20:58











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53435619%2fdelete-a-django-application%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













The problem is that your migration files constitute a version history of your project. So if another model once had a ForeignKey to a model in your deleted app, that reference is still in a migration file somewhere as a dependency.



One solution is to squash migrations and then delete the old files once all the databases are up to date. There are also more extreme ways to reset migrations.



If you've already deleted the app it may be too late to use the migrations machinery to fix this, so you may have to go through and edit the migrations by hand. Search the migrations directories for the name of your deleted app.






share|improve this answer





















  • I'll try your suggestion and see how I can remove references to it from my migrations
    – Parousia
    Nov 22 at 20:58















up vote
0
down vote













The problem is that your migration files constitute a version history of your project. So if another model once had a ForeignKey to a model in your deleted app, that reference is still in a migration file somewhere as a dependency.



One solution is to squash migrations and then delete the old files once all the databases are up to date. There are also more extreme ways to reset migrations.



If you've already deleted the app it may be too late to use the migrations machinery to fix this, so you may have to go through and edit the migrations by hand. Search the migrations directories for the name of your deleted app.






share|improve this answer





















  • I'll try your suggestion and see how I can remove references to it from my migrations
    – Parousia
    Nov 22 at 20:58













up vote
0
down vote










up vote
0
down vote









The problem is that your migration files constitute a version history of your project. So if another model once had a ForeignKey to a model in your deleted app, that reference is still in a migration file somewhere as a dependency.



One solution is to squash migrations and then delete the old files once all the databases are up to date. There are also more extreme ways to reset migrations.



If you've already deleted the app it may be too late to use the migrations machinery to fix this, so you may have to go through and edit the migrations by hand. Search the migrations directories for the name of your deleted app.






share|improve this answer












The problem is that your migration files constitute a version history of your project. So if another model once had a ForeignKey to a model in your deleted app, that reference is still in a migration file somewhere as a dependency.



One solution is to squash migrations and then delete the old files once all the databases are up to date. There are also more extreme ways to reset migrations.



If you've already deleted the app it may be too late to use the migrations machinery to fix this, so you may have to go through and edit the migrations by hand. Search the migrations directories for the name of your deleted app.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 22 at 20:52









Kevin Christopher Henry

22.2k46361




22.2k46361












  • I'll try your suggestion and see how I can remove references to it from my migrations
    – Parousia
    Nov 22 at 20:58


















  • I'll try your suggestion and see how I can remove references to it from my migrations
    – Parousia
    Nov 22 at 20:58
















I'll try your suggestion and see how I can remove references to it from my migrations
– Parousia
Nov 22 at 20:58




I'll try your suggestion and see how I can remove references to it from my migrations
– Parousia
Nov 22 at 20:58


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53435619%2fdelete-a-django-application%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

What visual should I use to simply compare current year value vs last year in Power BI desktop

Alexandru Averescu

Trompette piccolo