Customize Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorized as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... 

Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

No cookies to display.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

No cookies to display.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

No cookies to display.

Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement cookies are used to provide visitors with customized advertisements based on the pages you visited previously and to analyze the effectiveness of the ad campaigns.

No cookies to display.

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

Comments are closed.