How to uninstall django-rest-swagger?

1.4k Views Asked by At

Is there a simple or elegant way to uninstall django-rest-swagger on Windows 10? I've recently started developing API's and creating documentation. I found a tutorial that used the django-rest-swagger app. After installing the app and doing more reading, I discovered that it was deprecated, and the developer's GitHub page recommends using drf-yasg.

I tried using "pip uninstall django-rest-swagger," and that echoed back that the app was uninstalled. But, when I went into the virtual environment folder of the project, all the package folders were still there. I also tried "pipenv uninstall django-rest-swagger", but it returned "pipenv is not recognized..." I spent a few hours reading the app docs, and googling "how to remove/ uninstall django-rest-swagger." However, I didn't find anything useful.

Eventually, I gave up, and decided to do it the hard way. I manually deleted all the installed files. Fortunately, I hadn't updated my requirements.txt, so, I knew what was originally installed. While this solution worked, it was somewhat time consuming.

Does django-rest-swagger have an internal uninstall command? And does anyone know why "pip uninstall" didn't remove the app folders?

Thanks

1

There are 1 best solutions below

5
On BEST ANSWER

Just enable your virtualenv probably doing:

. /path/to/virtualenv/bin/activate

Then:

pip uninstall django-rest-swagger

Then go to settings.py and remove or comment the following line:

INSTALLED_APPS = [
    ...
    #'rest_framework_swagger',
    ...
]

And finally remove or comment in views.py the import and code related with swagger library:


from django.conf.urls import url
#from rest_framework_swagger.views import get_swagger_view

#schema_view = get_swagger_view(title='Pastebin API')

urlpatterns = [
#    url(r'^$', schema_view),
     ...
]

That's it.