Deployment Recipes Part 6 – Python, Web2py, Apache and Debian

In the last section we learned how we can troubleshoot certain issues that I faced while deployment. Today we go ahead and see how you can work with your OS (Debian in my case)

Checking sources for debian installation

You can check sources using below command

sudo nano /etc/apt/sources.list

Removing setup tools installed files manually (setuptools) python package

Note if you are using pillow the new fork of PIL only one can exist. Either PIL or Pillow.  We are using reportlab that uses pillow.

sudo python setup.py install –record files.txt

# inspect files.txt to make sure it looks ok. Then:

tr ‘\n’ ‘\0’ < files.txt | xargs -0 sudo rm -f —

To uninstall PIL if installed using dist packages . Delete the PIL directory once above is taken care of from path /usr/local/lib/python2.7/dist-packages/ PIL

 using rm -rf <dir-name>  command

Installing a python package forcefully using pip

pip install –upgrade –force-reinstall reportlab

Other commands

pip install reportlab

easy_install reportlab

pip install -ihttps://www.reportlab.com/pypi -U reportlab

Uninstall a python package

pip uninstall reportlab

Upgrade pip

Python –m pip install –upgrade pip   — This works if pip is already installed

Postgres SQL

In one of the upcoming article we would discuss the basics of handling Postgres DB. This is the DB that I had been using for my development purposes

6] Configure postgres sql

Create all required databases and

Follow section Configuring  postgres for web2py for configuration below

sudo -u postgres psql

7] DB access actual line for postgres (after configuration) in modesl/db.py

db = DAL(‘postgres://postgres:onlineserver@localhost:5432/bugbase’, pool_size=500,)

Debugging

  1. launch web2py from local instance  on a public IP and port and try to check the errors
  2. Killing locally launched web2py use kill -SIGTERM <#>
  3. ps aux to find processes

OR

  1. navigate to production machine – go to application/errors folder
  2. copy the tickets to local web2py / any application /errors folder
  3. and launch errors for the same app and check the description

Sessions – Cleanup

Sessions and their cleanup using session2trash.py


Dhakate Rahul

Dhakate Rahul

One thought on “Deployment Recipes Part 6 – Python, Web2py, Apache and Debian

Leave a Reply

Your email address will not be published. Required fields are marked *