How to import a Django application from Git into a project

I want to include a Django application in the project I'm working on. The app is hosted on Github ( https://github.com/lmorchard/django-badger ). In addition to the application directory containing goodies, there are several files at the root - README, LICENSE, TODO and setup.py. If I clone the application to the root directory of my project, the application folder will be in the right place, but these root files will be in the root directory of my project. How can I add an application while still tracking the source code on Github?

+5
source share
3 answers

I had a similar problem when I was working on two independent projects in which both were in repo mode and one of them used the other as an application:

  • Create virtualenv and install all the dependencies for both projects. I usually like to have virtualenv for each project / repo, but in this case you need one env that can execute Python from both repositories.
  • Clone both repos in an independent location. Do not clone the dependent application inside another project. Then your file structure might look like this (assuming the Django 1.3 project is hosted):

    project/
      manage.py
      project/
        __init__.py
        settings.py
        ...
      ...
    
    app/
      README
      ...
      app/
        __init__.py
        models.py
        ...
    
  • And the last step is to create a symbolic link (or shortcut in Windows) from the application directory in which it __init__.pyis located on the project path.

    $ ln -s /abs/path/to/app/app /abs/path/to/project/
    
  • Now you can use virtualenv to start the project!

, , , , .

+3

U ,

python setup.py 

pip

sudo pip install -e git+https://github.com/lmorchard/django-badger#egg=django-badger
0

Clone repository from github using git://github.com/lmorchard/django-badger.git. Then open the cloned folder in the terminal. Install the application using the command sudo python setup.py install. This will work well. If you want to include the application in your project, create a folder called badger (or whatever) and copy the installed application from dist packages to the created folder.

0
source

All Articles