admin has written 153 articles

Python bins fail to import library

Overview A binary (bin) file installed as part of a Python package, e.g. django-admin from Django will fail upon execution – even after successful installation via pip – because it cannot locate its corresponding Python library. Example: [myadmin@sol www]$ django-admin Traceback (most recent call last): File “/usr/local/bin/django-admin”, line 7, in <module> from django.core.management import execute_from_command_line portError: No module…

Updating from 4.1 to 4.1.1 fails after submitting FTP credentials – returns blank page

Overview When updating WordPress from 4.1 to 4.1.1, after inputting FTP information, WordPress returns a blank page. Cause WordPress 4.1 is shipped with a bug in its update module that prevents sending version information when looking for an available update through WordPress’ servers. (cf. ticket #31378) Solution WordPress has included, temporarily, a second Update Now button. This button…

Disabling Passenger built-in error handler

Overview Passenger provides a user-friendly, on-screen error handler to assist debugging a Python/Ruby/Node.js application. During production, however, this may result in unnecessary and possibly dangerous information disclosure. You can turn off Passenger’s built-in logger and use Apache’s generic error handler by adding the following line to your .htaccess file located within the public/ folder of your app:…

Running MongoDB

Overview MongoDB is fast, document-oriented NoSQL server. It’s complementary to key-value cache stores like Redis or Memcached and is suitable when necessary. It is available on newer platforms (v6+) without any additional compilation from source. Accounts with terminal access are eligible to use MongoDB. Quickstart From the terminal, first create a directory to store MongoDB data: mkdir…

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 load quickly, and applications utilize…

Restarting Passenger processes

Overview An application launched by Passenger may be restarted by creating a file in tmp/ (NB: not /tmp) within the application root directory, usually one level down from public/. Create a file under tmp/ named restart.txt to restart the application once. A restart will happen within 2 minutes. To restart an application on every request, very useful for…

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. If the default version works…