We have been experimenting with different development environment in my startup.
Thursday, October 30, 2014
Thursday, October 2, 2014
python+virtualenv on Cygwin
I recently made Linux my platform for development, Firstly ue to the similarity with my production platform. Secondly because most open source programming tool performs optimally in Linux based system.
However, unless I replace my ageing system with a Mac, I will still need Windows OS for my small day to day works. So I have been doing most of my techical jobs on Ubuntu 12, installed ob Oracle VirtualBox.
However, I have been noticing some annoying delay, which prompted me to consider using Cygwin.
After pulling my hair a bit, I managed to figure out how to install python developement tools on Cygwin.
However, unless I replace my ageing system with a Mac, I will still need Windows OS for my small day to day works. So I have been doing most of my techical jobs on Ubuntu 12, installed ob Oracle VirtualBox.
However, I have been noticing some annoying delay, which prompted me to consider using Cygwin.
After pulling my hair a bit, I managed to figure out how to install python developement tools on Cygwin.
- Install Python.
- Download and unzip pip.
- Install by going into the expanded directory and running python setup.py in a command prompt.
- Set the %PYTHONHOME% system variable to the python base directory, (i.e. C:\Python27\) and adding the python base directory and script directory (i.e. C:\Python27\Scripts) to your %PATH% system variable.
- Install Cygwin WITHOUT Python. The previous step tells Cygwin to use the Windows binary.
- Install Cygwin-Virtualenvwrapper using pip install https://bitbucket.org/cliffxuan/virtualenvwrapper-for-cygwin-windows-python/get/tip.tar.gz
- Install virtualenvwrapper-win using pip install virtualenvwrapper-win
- Make a symlink between Cygwin's virtualenvhome directory and Windows's using ln -s /cygdrive/c/Users/<USER>/Envs/ ~/.virtualenvs
- Add the following to Cygwin's .bashrc file:
- Go to
C:\User\<username>\Env(or other%VIRTUALENV_HOME%location) and usevirtualenvto start a new environment. Doing this allowsvirtualenvwrapper-win'sworkoncommand to work.
export VIRTUALENVWRAPPER_PYTHON="/cygdrive/c/Python27/python.exe" export VIRTUALENVWRAPPER_VIRTUALENV="/cygdrive/c/Python27/Scripts/virtualenv.exe" source virtualenvwrapper.sh
Labels:
flask,
Installation,
linux,
Programming,
python,
Windows
Wednesday, October 1, 2014
Happy 54th NIGERIA!
Its Nigeria 54th Independence, and am happy to join all other Nigeria to say HAPPY INDENPENCE DAY NIGERIA.
Our future is better than our past!!
And thanks to the people from @Google for the beautiful doodle
Our future is better than our past!!
And thanks to the people from @Google for the beautiful doodle
Friday, August 22, 2014
Only in Nigeria!
- its only in Nigeria that airports get flooded oh
- only in Nigeria Health, Education, Security and Agriculture are on the negative scale!!!
- Only in Nigeria you see such rubbish!
- Its only in Nigeria people vote Name
- It's only in Nigeria; dat u'll be judged on wat u wear, music taste, hw u act on social ntwrks, wat u luk like, nd evn d kinda phone u use
- Its only in Nigeria that a football club's Twitter account will be flirting with a female follower.
- Only in Nigeria will the supposed cure for something have killed more people than the disease itself
- Ex-Nigeria coach Chief Adegboye Onigbinde: “It is only in Nigeria that a carpenter is allowed to run sports and most especially football."
- Only in Nigeria can you rewrite recent history
... a few selection from Twitter
Few things ticks me off like the "Only in Nigeria" phrase. This is very pertinent in social media, by "critics" to protest one incident or the other.
Its has become so pervasive, that even supposedly enlightened people have joined/leading the bandwagon.
It is more annoying because.
- It cannot be true
- Even if its true (or not), does it make it right?
- It amounts to intellectual laziness
A better response below:
Small advice: Before you say 'Only in Nigeria' ask Google. You could get 7509782 results in 0.75 secs.
— Aunty Abigail (@Anabagail) August 21, 2014
Its "Only in Nigeria" that people think things happen "Only in Nigeria". There i have said it.. does its sound stupid?
Wednesday, July 23, 2014
Deploying a Flask Project on WebFaction with Git
I found it tedious
having to redo the setup of my application on WebFaction whenever there is a
new update of the application. I started looking for way to update the content
of the application, without affecting the setup configurations of the application
on WebFaction.
Step 1: Add your site
to Your WebFaction Account
From your WebFaction
console:
2.
Go
to your “Websites” tab, click the “Add New Website” button
3.
Enter
the website name and domains as needed for your project
4.
Under
the Contents section, choose Add an Application >
Create a New Application
1.
Name to
"myapp"
2.
Set App
Category to “mod_wsgi”
3.
App Type should
be the most recent version of mod_wsgi that supports your Python
version. Make sure that your Python version matches with your mod_wsgi
choice ( “mod_wsgi 3.5/Python 2.7″ for this guide).
4.
Click
the Save button to add that application
5.
Click
the Save button to save your website
Now your WebFaction account should have a new
domain, website, and mod_wsgi
application.
Step 2: SSH into your
new application
In this directory,
you’ll see two folders:
-
apache2/ # This contains all of your Apache
config and action files
-
htdocs/ # This is the folder Apache looks
into (by default) to launch your project
Step 3: Upload your
Flask project using Git
Upload the project/
folder to the application directory using Git. "myapp" directory is created
git clone https://username@bitbucket.org/uobis0/myapp.git
==OR==
git init
git remote add origin https://username@bitbucket.org/uobis0/myapp.git
git fetch
git branch master origin/master
git checkout master
Now, my ~/webapps/myapp directory list looks like the following:
- apache2/
-
config.py
-
libs/
-
app/
-
static/
-
templates/
-
__init__.py
-
views.py
-
models.my
- htdocs/
Step 4: Edit
apache2/conf/httpd.conf
LoadModule dir_module
modules/mod_dir.so
LoadModule
env_module modules/mod_env.so
LoadModule
mime_module modules/mod_mime.so
LoadModule
rewrite_module modules/mod_rewrite.so
LoadModule
wsgi_module modules/mod_wsgi.so
LoadModule alias_module
modules/mod_alias.so #Your version of
mod_wsgi might not need to add this.
<Directory
/home/username/webapps/myapp/htdocs>
AddHandler wsgi-script .py
RewriteEngine
On
RewriteBase /
WSGIScriptReloading On
</Directory>
# This will ensure
that domain.com/static points to the flask static directory
Alias /static/
/home/username/webapps/myapp/myapp/app/static/
# This points to the
file that launches the site
Alias /
/home/username/webapps/myapp/htdocs/index.py/
Step 5: Make
sure your init.py file is right (optional)
Ensure that, whatever
your structure, your project’s __init__.py file is launching your Flask application. This is what the
file at ~/webapps/myapp/myapp/app/__init__.py should look like:
from
flask import Flask
#
Setting up the App
app
= Flask(__name__)
app.config.from_object('config')
#
Importing the views for the rest of our site
from
app import views
if __name__ == '__main__':
app.run()
This will work
nicely with our htdocs/index.py file, which we’ll set up next.
WebFaction should have
created this file. In it are a few scripts, but you can completely remove
those. Here is what the ~/webapps/myapp/htdocs/index.py file should contain:
import sys
# Active your Virtual
Environment, which I'm assuming you've already setup
activate_this='/home/username/webapps/myapp/venv/bin/activate_this.py'
execfile(activate_this,
dict(__file__=activate_this))
# Appending our Flask
project files
sys.path.append('/home/username/webapps/myapp/myapp')
# Launching our app
from main import app
as application
Step 7: Restart Apache
The last step will be
to restart apache, like so:
~/webapps/myapp/apache2/bin/restart
If you’re having
trouble, take a look at your logs in the ~/logs/users/ directory.
The steps above makes
updates very easy:
cd ~/webapps/myapp/myapp
git pull https://username@bitbucket.org/uobis0/myapp.git
~/webapps/myapp/apache2/bin/restart
Monday, March 17, 2014
NIS Job Test Charade!
Five things comes to mind after hearing that 7 people died yesterday while trying to write an Exam for Nigerian Immigration Services (NIS)
Lastly, I will like to find out from the President and Minister of Finance/Cordinating minister for Econony the qustion US President George Bush asks Head of State
- We have a serious problem of Unemployment in Nigeria
- We have very undisciplined youth? Why did "gatecrashers" jump into a hall when they were not invited?
- The Exam organizers are incompetent and corrupt!
- One of Minister of Interior or DG NIS should be sacked for this charade..
- Nobody who respect him/her self should put him/herself through that!
Lastly, I will like to find out from the President and Minister of Finance/Cordinating minister for Econony the qustion US President George Bush asks Head of State
“What keeps you up at night?”
Rampaging REDS!!
In March 15, 2009, Liverpool played one of the most complete game i have seen in Old Trafford.
Exactly 5 years later, we played another wonderful game, although this time, Liverpool came as favorites.
The score looks as good as before, so i say YNWA!! Common REDS!!
Exactly 5 years later, we played another wonderful game, although this time, Liverpool came as favorites.
The score looks as good as before, so i say YNWA!! Common REDS!!
Subscribe to:
Posts (Atom)

