简体   繁体   中英

How Can we Create a plugin and Play Architecture in Django?

Actually, I want to create a plug and play architecture in Python Django. I have a different kind of scrapers and I am writing more scrapers too. Whenever I build a new scraper I have to again publish my repo in production. What I need I just want to plug that new scraper without actually again deploying my code. I have already used the GitHub versioning system but I am in need of a more clean way. Thanks in advance.

What you should be doing is Generating the Setup.py File which would automatically set it up as a package thus, When the User would run the Setup.py File,

It would deploy it as a package. Second Thing is you can create a Package out of It with the tools already provided by Python to create a Package of an App in Django.

Packaging a Python Script: https://the-hitchhikers-guide-to-packaging.readthedocs.io/en/latest/quickstart.html https://pythonhosted.org/an_example_pypi_project/setuptools.html

For Django, Follow below Steps:

  1. Initilize it with a ReadMe File
  2. Initilize it with a MANIFEST.in to include the text files and static files in our package
  3. run python setup.py build Reference: https://www.pythoncentral.io/package-python-django-application-reusable-component/ Now Simply Use it anywhere You Wish making it a Reusable App!

Reference for a Package Settled Up: https://github.com/smfai200/rebound

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM