Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there such things as Django gems - plugins , like there are Ruby gems

Tags:

python

django

Are there such things as Django gems - plugins , like there are Ruby gems ,

like auth management plugin, etc.

like image 218
Toomas Neli Avatar asked Jan 05 '11 07:01

Toomas Neli


People also ask

What is difference between gems and plugins?

The basic difference is a gem is something that needs to be installed on the system running your Rails application, whereas a plugin is deployed along with your application. More specifically, plugins live in vendor/plugins whereas gems need to be install using rake gem install gem_name.

What are Rails gems?

Gems in Rails are libraries that allow any Ruby on Rails developer to add functionalities without writing code. You can also call Ruby on Rails gems as plugins for adding features. A Ruby gem enables adding features without creating the code again and again.

What can ruby gem be used for?

The most common use for rubies is jewelry—stunning jewelry! However, both natural and synthetic rubies are used in a variety of applications—such as watchmaking, medical instruments, and lasers—because of their incredible strength and red fluorescence.

What does gem mean in Ruby?

A gem in Ruby programming language is a software package in which Ruby applications or libraries can be distributed in a single format.


2 Answers

To add a little more detail to the other answers, the equivalent of Ruby gems are Python "eggs". I don't know Ruby so I'm not sure how exact that equivalence is, but eggs are basically the install files for Python packages - they give Python information about which packages are installed. The egg is typically created by running ./setup.py install from within the package directory or by using setuptools, i.e. pip install NAME-OF-PACKAGE (the latter method is usually easier as it will download the files for you and install all the needed dependencies). It should be noted that any package (any folder with an __init__.py file in it) or module that is placed on the PYTHONPATH can be imported by Python; installing them just helps keep track of which packages are being used and makes it easier to work with complicated packages that have a lot of dependencies.

In Django, as @EinLama mentioned, these add-on packages function as Apps (they typically include files like models.py, views.py, urls.py, etc). Some of them are actually installed by Python as described above, and some are just folders that should be put on your PYTHONPATH (in both cases you also have to add them to the installed apps in your settings.py file so Django knows about them). In addition, I often come across (open source) packages that do almost what I want, but not exactly, or that are designed in such a way that the details which must be changed to integrate the app into my project are hard-coded. In these cases, I often put the app directly in my project folder, where I can make changes as necessary and access it as if it's any of my other apps. In this case the package is, of course, confined to that particular Django project - it is never installed by Python and no egg is created.

Hope that clarifies things a bit.

like image 175
danny Avatar answered Sep 19 '22 18:09

danny


There are Python eggs, which are much like Ruby Gems. I'm sure some of them add functionality to Django. And there are things like Django Extensions

like image 45
philosodad Avatar answered Sep 21 '22 18:09

philosodad