Skip to main content

A Django application that emulates the Python Package Index.

Project description

DjangoPyPI 2

DjangoPyPI is a Django application that provides a re-implementation of the Python Package Index. Using Twitter Bootstrap for UI, forked from the original DjangoPyPi project, DjangoPyPi2 provides an easy to use and manage interface.

Compatibility Note

This is a fork of the original djangopypi package. This version is somewhat different than the original version by its design, and it might affect older version in that the database table names are different than the original ones. It is highly recommended that you install a fresh copy of this package and manually transfer you data from your installation.

Since the table names in this installation are different, the same database can be used for the migration. Unfortunately there are too many versions of djangopypi our there, so it’s quite dangerous to create south migrations for them. Sorry for the inconvenience.



The first step is to get djangopypi2 into your Python path.


Simply add djangopypi2 to your list of eggs and run buildout again it should downloaded and installed properly.


If you have setuptools installed, you can use easy_install djangopypi2


Download and unpack the source then run:

$ python install

Django Settings

Make sure all the following apps are in your INSTALLED_APPS setting:


And add the following to TEMPLATE_CONTEXT_PROCESSORS (this setting is absent by default, in which case simply add it):


Then, make sure the STATIC_ROOT setting is configured properly:

STATIC_ROOT = '/path/to/static/root'

And update the urlpatterns to include djangopypi2.urls:

urlpatterns = patterns("",
    url(r'', include("djangopypi2.urls"))

This serves the following: * /:: Normal web interface. * /pypi/:: Repository interface. * /simple/:: Simple interface. * /static/:: Your static files (only if DEBUG=True) * /favicon.ico

Finally, run the following Django commands to sync everything syncdb:

$ ./ syncdb
$ ./ migrate pypi_config
$ ./ migrate pypi_frontend
$ ./ loaddata initial
$ ./ collectstatic
Package upload directory

By default packages are uploaded to <MEDIA_ROOT>/dists so you need both to ensure that MEDIA_ROOT is assigned a value and that the <MEDIA_ROOT>/dists directory is created and writable by the web server.

You may change the directory to which packages are uploaded by setting DJANGOPYPI_RELEASE_UPLOAD_TO; this will be a sub-directory of MEDIA_ROOT.

Package download handler

Packages are downloaded from the following URL: <host>/simple/<package>/dists/<package>-<version>.tar.gz#<md5 hash>

You will need to configure either your development server to deliver the package from the upload directory, or your web server (e.g. NGINX or Apache).

To configure your Django development server ensure that looks something like following:

import os
from django.conf.urls import patterns, include, url
from django.conf import settings

# ... other code here including Django admin auto-discover ...

urlpatterns = patterns('',
    # ... url patterns...

    url(r'^simple/[\w\d_\.\-]+/dists/(?P<path>.*)$', 'django.views.static.serve',
            {'document_root': os.path.join(settings.MEDIA_ROOT,
    url(r'', include("djangopypi2.urls")),

    # .. url patterns...

This should only be used for the Django development server.

When using a web server, configure that to deliver packages from the upload dist directory directly from this URL. For example, you may have a clause in an NGINX configuration file something like the following:

server {
  ... configuration...

  location ~ ^/simple/[a-zA-Z0-9\,\-\.]+/dists/ {
      alias /path/to/upload/dists/;

  ... configuration...

Uploading to your PyPI

Assuming you are running your Django site locally for now, add the following to your ~/.pypirc file:

index-servers =



Uploading a package: Python >=2.6

To push the package to the local pypi:

$ python register -r local sdist upload -r local

Uploading a package: Python <2.6

If you don’t have Python 2.6 please run the command below to install the backport of the extension for multiple repositories:

$ easy_install -U collective.dist

Instead of using register and dist command, you can use mregister and mupload which are a backport of python 2.6 register and upload commands that supports multiple servers.

To push the package to the local pypi:

$ python mregister -r local sdist mupload -r local

Installing a package with pip

To install your package with pip:

$ pip install -i <PACKAGE>

If you want to fall back to PyPi or another repository in the event the package is not on your new server, or in particular if you are installing a number of packages, some on your private server and some on another, you can use pip in the following manner:

$ pip install -i http://localhost:8000/simple/ \
  --extra-index-url= \
  -r requirements.txt

(substitute your djangopypi2 server URL for the localhost one in this example)

The downside is that each install of a package hosted on the repository in --extra-index-url will start with a call to the first repository which will fail before pip falls back to the alternative.


0.5.0 (2012-10-03)

  • Removed south support (too many changes), hopefully added in a future version
  • Added bootstrap-based user interface
  • Split djangopypi to several Django apps
  • Switched to relative imports
  • All configuration resides in the database and editable from the admin
  • Static files are automatically served when DEBUG = True
  • Removed loadclassifiers command
  • Contains fixtures with initial data for all configuration models

0.4.4 (2012-04-18)

  • xmlrpc bug fixes
  • CSRF token template tags on forms
  • Transaction bug fixes
  • Switched to logging over stdout
  • Proxy simple and detail views when necessary
  • Removed unused legacy view, submit_package_or_release
  • ppadd management command working again

0.4.3 (2011-02-22)

  • Moved xmlrpc views into views folder
  • Moved xmlrpc command settings to the settings file
  • Cleaned up xmlrpc views to remove django.contrib.sites dependency

0.4.2 (2011-02-21)

  • Added CSRF support for Django>=1.2
  • Added conditional support to proxy packages not indexed

0.4.1 (2010-06-17)

  • Added conditional support for django-haystack searching

0.4 (2010-06-14)

  • ‘list_classifiers’ action handler
  • Issue #3: decorators imports incompatible with Django 1.0, 1.1
  • RSS support for release index, packages
  • Distribution uploads (files for releases)

0.3.1 (2010-06-09)

  • Installation bugfix

0.3 (2010-06-09)

  • Added DOAP views of packages and releases
  • Splitting djangopypi off of chishop
  • Switched most views to using django generic views

Backwards incompatible changes

  • Refactored package/project model to support multiple owners/maintainers
  • Refactored release to match the metadata only that exists on
  • Created a Distribution model for distribution files on a release

0.2.0 (2009-03-22)

  • Registering projects and uploading releases now requires authentication.
  • Every project now has an owner, so only the user registering the project can add releases.
  • md5sum is now properly listed in the release link.
  • Project names can now have dots (‘.’) in them.
  • Fixed a bug where filenames was mangled if the distribution file already existed.
  • Releases now list both project name and version, instead of just version in the admin interface.
  • Added a sample buildout.cfg. Thanks to Rune Halvorsen (

Backwards incompatible changes

  • Projects now has an associated owner, so old projects must be exported and imported to a new database.

0.1.0 (2009-03-22)

  • Initial release


Project details

Release history Release notifications

History Node


History Node


History Node


History Node


History Node


History Node

History Node


History Node


History Node


History Node

History Node


History Node


History Node


This version
History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
djangopypi2-0.5.0.tar.gz (121.5 kB) Copy SHA256 hash SHA256 Source None Oct 3, 2012

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page