Search code examples
pythonpyramidpaster

How do I create a project without the project folder?


I'm new to pyramid and paster, just reading the docs for now. I use virtualenv and inside the virtualenv dir I want to start a pyramid project. The problem is that I would like for paster to not create a dir with the project name, and instead put all the scaffold files on the current dir (the venv root).

I thought about just not using paster but I still wouldn't know how to point to my app on development.ini "use" option.

I could also have my virtualenv on an entirely different place of my filesystem, but that seems weird to me (maybe virtualenvwrapper could make it easier). Any other way to do this?


Solution

  • This is really just bike shedding because how you create the project and the virtualenv are irrelevant and you can place either of them anywhere, including within each other.

    However, if you really want to, you can paster create -t pyramid_starter -o .. <current_directory_name> to create the project within the current directory.

    To create a new project:

    cd ~/work/my_repo
    virtualenv --no-site-packages env
    env/bin/pip install pyramid
    env/bin/paster create -t pyramid_starter -o .. my_repo
    git init
    echo 'env' > .gitignore
    git add .
    

    I'll usually do this when setting up a new machine:

    cd ~/work
    git clone /path/to/<my repo>.git
    cd my_repo
    virtualenv --no-site-packages env
    env/bin/pip install -e . # equivalent to env/bin/python setup.py develop
    

    Using the setup I just mentioned, you'd want to add the env directory to your .gitignore file.