Robert Johnstone
Robert Johnstone

Reputation: 5371

Using Django on OpenShift

Expanding on this question I am trying to deploy Django on OpenShift but I'm having some problems understanding OpenShift.

I have managed to get as far as setting up a quick app with the git repo https://github.com/openshift/django-example but have the following questions:

  1. Can I develop locally after git cloning to my local? (virtualenv, adding packages)
  2. Packages, what's the deal? local, remote, adding, sycing, virtualenv, git, ...
  3. I came across this line in Nate Aune's PaaS Bakeoff (slide 42) for setup.py and it looks quite useful:

    install_requires=open('%s/project.txt' % \
        os.environ.get('OPENSHIFT_REPO_DIR', PROJECT_ROOT)).readlines(),
    

(because I know I can pip freeze > requirments.txt in my virtualenv)

... Is %s/project.txt in wsgi or tthe directory below wsgi? Do I have to set PROJECT_ROOT with some funky os stuff?

EDIT

Basically:

  1. Is it best to ssh into your OpenShift application (lest say you have a dev one) and work there or work off a local copy?
  2. How do you install python packages after you have ssh'ed in to your OpenShift app? (virtualenv)
  3. If you ssh'ed into your OpenShift app do you have to do anything after: creating a project, creating an app (manage.py startapp ...), changing code in your django app

If local is the best option:

  1. How do I use the example locally?
  2. Do I need to setup a virtualenv to work locally?
  3. How do I make sure the python packages django needs are on OpenShift?
  4. How do I add python packages to my OpenShift version (I'm presuming git doesn't do that)

Upvotes: 1

Views: 781

Answers (2)

Naf Qan
Naf Qan

Reputation: 11

I was facing a similar situation and found the answer provided by Luis Masuelli to the question posted here very informative. Hope it might help you.

Upvotes: 1

HcMc
HcMc

Reputation: 49

I would suggest developing in a local copy. In my experience there is no reason to ssh in, unless if you need to perform one-of operation (migrating databases for example)

The requirements for the openshift app are specified in the setup.py file.

install_requires=['Django>=1.6.0', 'redis>=2.0']

Locally you can of course work in a virtualenv

Upvotes: 4

Related Questions