Setup Basic FreeBSD PINAX Django Based Platform

Pinax is an open source platform built on the Django Web Framework. It's a reusable ecosystem of Django apps, themes, and starter project templates. Pinax addresses what many sites have in common so we can focus on what makes our site different from others.




1. Pinax Features

This application was previously called biblion when it was first developed by Eldarion, Inc. After donating Pinax, this application was renamed pinax-blog, making it easier to find and know what Pinax Blog is.

Pinax has several advantages, including:
  1. Support for multiple channels (e.g. technical vs business).
  2. Use of Creole (optional) and Markdown as markup formats.
  3. Atomic and RSS feeds.
  4. Preview blog posts before publishing.
  5. Ability to announce new posts on twitter.
  6. Traditional date based urls or simpler slug specific urls, through configuring control over opengraph meta data and twitter cards per post.
  7. Can review comments per post for multi-author workflows.
  8. Public but confidential URLs for unpublished blog posts for easier review.

Pinax is a project designed by James Tauber not to reinvent the wheel but to understand the wheel better. That's how he put it in his talk on the subject and what happened with the reinvention of what was originally called Hotclub and is now Pinax . The project now provides the glue and support for a large number of what Django developers call “apps” and allows a single developer to deploy a complete social-focused web application that they control at every level.

Tauber came up with the idea of bringing together a large number of third-party, community-developed Django applications to build a larger project while building a series of community websites. First a personal wiki he calls Leonardo, Quisition (an online flashcard website), and finally a Harry Potter prediction site. He began to realize that he was rewriting or reusing many of the same Django applications and began to envision convincing a team of volunteers to help refine and develop many of these applications to support the entire Django community.

However, Tauber had difficulty getting anyone to help write or maintain the application and decided to create this multi-part project. Tauber uses the following quote from Antoine de Saint Exupéry: "If you want to build a ship, do not put your labor into gathering wood, dividing the work, and giving orders. Instead, teach them to long for the vast and endless sea."

The focus of the project then shifted to creating the Pinax project, with the hope that a scaffolding for social networking built on reusable applications would be the one that would get more tender attention with the goal of creating something greater than the sum of its parts. Until 2008, this project has continued to progress rapidly since then. The project became so popular that a demonstration site created to showcase the platform's capabilities became a popular social networking site (more than 1,000 active users were using it as of July 2008).

Tauber says he hopes to convince more developers who want to build this type of website to use Pinax (and Django) rather than reinventing this particular wheel and actively solicits feedback to learn why or why the platform doesn't suit their needs.


2. Installing Pinax on FreeBSD

On FreeBSD systems, Pinax can only be run using the Python environment. To start Pinax you must first install the dependencies that Pinax needs so that it can run perfectly on a FreeBSD system. The following are Pinax dependencies that must be installed first.

root@ns1:~ # cd /usr/ports/devel/py-pip
root@ns1:/usr/ports/devel/py-pip #
make install clean
root@ns1:/usr/ports/devel/py-pip #
cd /usr/ports/databases/py-sqlite3
root@ns1:/usr/ports/databases/py-sqlite3 #
make install clean
root@ns1:/usr/ports/databases/py-sqlite3 #
cd /usr/ports/graphics/py-pillow
root@ns1:/usr/ports/graphics/py-pillow #
make install clean
root@ns1:/usr/ports/graphics/py-pillow # cd /usr/ports/shells/bash
root@ns1:/usr/ports/shells/bash # make install clean

After all the dependencies are installed, now we will create a virtual Python environment. But before that we will create a folder to work with Pinax. In this article we will create a Pinax folder in /tmp/pinax.

root@ns1:~ # mkdir -p /tmp/pinax
root@ns1:~ #
cd /tmp/pinax
root@ns1:/tmp/pinax #

The script above will create a Pinax working folder located at /tmp/pinax. Now we will go to the /tmp/pinax folder via the python environment or virtual python.

root@ns1:/tmp/pinax # virtualenv pinaxproject
root@ns1:/tmp/pinax #
cd pinaxproject
root@ns1:/tmp/pinax/pinaxproject #
source bin/activate.csh
(pinaxproject) root@ns1:/tmp/pinax/pinaxproject #

The script above creates a python virtualenv with the name "pinaxproject" and the command "source bin/activate.csh" to activate the virtualenv environment. Once the Python virtual environment is active and we are in the virtual environment, this is marked with the blue (pinaxproject) script mark above, then we can install the Pinax application. Here's how to install Pinax on virtual Python.

(pinaxproject) root@ns1:/tmp/pinax/pinaxproject # pip install Pinax
(pinaxproject)
root@ns1:/tmp/pinax/pinaxproject # pip install pinax-cli

After that we continue by installing Django.

(pinaxproject) root@ns1:/tmp/pinax/pinaxproject # pip install Django
Collecting Django==2.0
Downloading Django-2.0-py3-none-any.whl (7.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.1/7.1 MB 1.3 MB/s eta 0:00:00
Collecting pytz (from Django==2.0)
Downloading pytz-2023.3-py2.py3-none-any.whl (502 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 502.3/502.3 kB 1.3 MB/s eta 0:00:00
Installing collected packages: pytz, Django
Attempting uninstall: Django
Found existing installation: Django 4.2.4
Uninstalling Django-4.2.4:
Successfully uninstalled Django-4.2.4
Successfully installed Django-2.0 pytz-2023.3

(pinaxproject) root@ns1:/tmp/pinax/pinaxproject/templatesosialmedia #


After that, we create a template account with the name templatesocialmedia.

(pinaxproject) root@ns1:/tmp/pinax/pinaxproject # pinax start account templatesosialmedia

Then type the following command to run Pinax.

(pinaxproject) root@ns1:/tmp/pinax/pinaxproject # cd templatesosialmedia
(pinaxproject) root@ns1:/tmp/pinax/pinaxproject/templatesosialmedia # pip install -r requirements.txt
(pinaxproject) root@ns1:/tmp/pinax/pinaxproject/templatesosialmedia # python manage.py migrate
(pinaxproject) root@ns1:/tmp/pinax/pinaxproject/templatesosialmedia # python manage.py loaddata sites
(pinaxproject) root@ns1:/tmp/pinax/pinaxproject/templatesosialmedia # python manage.py runserver


From there, you can add apps and create or customize templates just like you would for any Django project. The difference is that you just saved yourself a few hours of installing and configuring apps.

As for themes, they try to promote the idea of a theme as an application containing nothing more than static files. Take a look at the repo for the default theme to see how it works (it's basically just an app with static files and templates).

If you are an amateur creating a single website that is your own project, don't worry about Pinax, and if you are a developer who is constantly creating new websites from scratch, Pinax can be your friend.
Iwan Setiawan

I Like Adventure: Mahameru Mount, Rinjani Mount I Like Writer FreeBSD

Post a Comment

Previous Post Next Post