• Write permission error when installing gems

    Overview On newer v6+ platforms with support for multiple Ruby interpreters, installing a gem may fail resulting in a similar error message: [user@sol ~]$ gem install –no-rdoc –no-ri passenger rails Fetching: passenger-5.0.6.gem (100%) ERROR: While executing gem … (Gem::FilePermissionError) You don’t have write permissions for the /.socket/ruby/gems/ruby-2.1.2 directory. Cause The…

  • Changing Ruby versions

    Overview Newer hosting platforms, v6+, support multiple Ruby versions through rvm. This enables you to run multiple versions of Rack and Rails using any available Ruby interpreters. Currently, versions 1.8 to 2.2 are supported. Important: Avoid using 1.8, except to shim an older application with an intent to upgrade. 1.8…

  • Pyramid Quickstart

    Overview Pyramid is a Python framework that is the spiritual successor to Pylon and Zope, frameworks popular in the mid-to-late 2000s. Pyramid is supported with on v6+ platforms using any Python version from 2.7 onward with Passenger. Quickstart All commands are done from the terminal for convenience. PREREQUISITE: create a suitable…

  • Installing packages

    Overview Python uses a package management system called “pip“. Package management is available on newer hosting platforms v4.5 and above. Terminal access is necessary to use the feature. Package management All packages installed reside under /usr/local/lib/python/<VERSION> where <VERSION> is the Python version. Python versions may be switched on-the-fly using pyenv on v6 platforms. Important…

  • Django quickstart

      Overview Django is a web framework based on Python. Python is available on all packages, and a Django application may be uploaded on any package. But, to create a new project on the server and complete this quickstart, a package with terminal access is necessary. This quickstart covers using Django with…

  • Changing Python versions

    Overview Recent platforms (v6+) support multiple Python interpreters from the shell using pyenv. pyenv allows seamless switching between available Python versions, and manages version-specific package installations too. Basics All commands are done from the terminal. Listing versions To get a current list of available Python interpreters, use pyenv versions: [myadmin@sol ~]$ pyenv…

  • Using multiple versions with Passenger

    Overview Passenger provides an intelligent polyglot launcher interface for managing Node.js, Ruby, and Python processes. This can be teamed up with pyenv to effortlessly launch multiple Python applications with a single shell command and .htaccess directive. These steps are only necessary to use supplementary Python versions available on the server….

  • Using WSGI

    Overview Python applications can be launched using Passenger offering improved throughput and lifecycle management. Launching CGI scripts wrapped by pyenv will yield very poor throughput as a result of multiple shell subprocesses necessary to ascertain the correct Python interpreter. Adapting a CGI application to WSGI improves throughput significantly by reducing overhead through a persistent process. Pages…

  • E-mails sent from Django appear as webmaster@host.domain.tld

    Overview E-mails sent from a Django application may use “webmaster@host.domain.tld” or another erroneous address as the From field. Cause ServerAdmin values are not set in Apache configuration for virtual hosts to prevent unintentional information leakage. Solution Set DEFAULT_FROM_EMAIL and SERVER_EMAIL in your Django settings file. An example configuration follows: EMAIL_HOST=’localhost’ EMAIL_PORT=’587’ EMAIL_HOST_USER=’myadmin@mydomain.com’ EMAIL_PASSWORD=’mysmtppassword’ DEFAULT_FROM_EMAIL=EMAIL_HOST_USER SERVER_EMAIL=EMAIL_HOST_USER Replace…

  • Flask Quickstart

    Overview Flask is a Python microframework for building web sites with minimal overhead. Think of it as a lightweight version of Django with fewer features, but better speed. Flask is supported on v6+ platforms using Passenger. Quickstart All steps are done from the terminal. While it may be possible to deploy…