Skip to main content

Posts

Showing posts from March, 2018

Django + Docker-Compose deployment to Heroku

Setting up a docker-compose django project 1. Follow the django docker-compose guide set-up here . 2. Your working directory should now contain all files listed below Dockerfile docker-compose.yml manage.py requirements.txt 3. Test that you app is running locally $ sudo docker-compose up   4. Navigate to localhost:8000 on your web browser to test if everything is working as expected. Django production application configuration 1. Modify your Dockerfile as follows Dockerfile FROM python:3.6.4 ENV PYTHONUNBUFFERED 1 ENV PORT 5000  RUN mkdir /code WORKDIR /code ADD requirements.txt /code RUN pip install -r requirements ADD . /code CMD python3 manage.py runserver 0.0.0.0:$PORT  2. Modify your wsgi.py file as follows wsgi.py import os from django.core.wsgi import get_wsgi_application from whitenoise.django import DjangoWhiteNoise ...

How to transfer a gitlab repository into github

Method 1: Use the linux command line 1. Assume you have a gitlab repository called matric2016.git 2. Create a new working directory: $ mkdir myproj && cd myproj $ git clone gitlab@gitlab.com/Banzyme2/matric2016.git $ cd matric2016.git Make sure you create a github repository with the same name as the gitlab repository ,i.e. matric2016  3. Clone your project into github as follows:  $ git remote add github https://github.com/Banzyme/matric2016.git  $  git push --mirror github Method 2: Using the github dashboard repository import 1. Click "+" next to your github profile. Select import repository 2. Fill out the import form  as follows

Gunicorn vs NGINX Explained

Web applications typically disseminate information via three server layers: Web server   - First layer: Receives request from client(web browser) Application server - 2nd layer: Receives requests from web server if the client is requesting dynamic content Database - 3rd layer: Receives database queries from web framework's request handler methods In this example , nginx is the web server, gunicorn is the application server (interface between nginx and web framwork request handling function) and the database can be assumed to be a lightweight sqlite3 database. Example: Django architecture Alternatives to nginx : Cherokee Apache HTTP server Alternatives for gunicorn: Apache Mongoose

Setting up Django for Heroku Deployment

In this tutorial , we are going to show how to deploy your Django 2.0 web application on the Heroku platform. This tutorial assumes that you are familiar with the django framework, git and the Linux command line. In addition if you haven't done so already, register an account with Heroku . Django dependencies SETUP Install virtual env on your linux machine $ sudo apt-get install virtual env A virtual environment such as (virtual env) allows you to run your application in an isolated environment from your local machine. This is useful if you have multiple applications on your computer that use different versions of certain software packages( python 2.7 for application 1 and python 3.6.4 for application 2) 2. Navigate to your working directory to Create and Activate the virtual environment $ virtualenv  .vEnv $ .  .vEnv/bin/activate Take care not to omit the dots! 3. Install django 2.0 using pip ( Note: You need to have python3 and pip pre-installed...

Where to get data-sets to practice data science?

Data is the new science. Big data holds the answers. - Pat Gelsinger, CEO 1. Programmable Web  Description:   This is a site where you can obtain API's to extract data from some of the biggest sites on the internet. Link address:   API Directory Examples : Google maps API, Instagram API, Twitter API etc. 2. Postman API Development Description:   An online tool that you can use to access millions of APIs on the internet. You can also develop your own API if you happen to own a site. Link address:   API TOOL  Examples : Paypal API, Adobe API, Coursera API etc. 3. Facebook graph Description:   An online tool that you can use to access data about Facebook pages. Link address:   API  Examples : graph.facebook.com/youtube  - Access page data, e.g likes, number of posts etc. 4. APIGEE Description:   An online GUI tool that lets your extract and send data to various web platforms Link ad...

How to install python 3 in Ubuntu 16.04 / LIve USB

The following guide will help you get started with installing python3 and pip3 on your linux( Ubuntu 16.04 ) live USB.  1. First install python 3 from the "deadsnakes" repository from the Python Package Accesories ( PPA ) $ sudo add-apt-repository ppa:deadsnakes/ppa $ sudo apt-get update $ sudo apt-get install python3.6 This will install both python 3.5.2 and python 2.7.2 on your machine. Verify the installation by running python3 --version or python --version on the linux command line.  2. Next up, install pip3 package manager that will allow you to install other useful python libraries such as numpy,seabon ,pandas etc. $ sudo apt-get update $ sudo apt-get install python3-setuptools $ sudo easy_install3 pip  Once again, verify the installation by running pip3 --version on the command line. 3. You can now use pip3 to install non-core python libraries as follows   $ sudo pip3 install jupyter  $ sudo pip3 numpy etc.

PIP vs CONDA

Both are ' package managers' that can be used to install python packages such as numpy, matplotlib, seaborn etc. Although conda is more of an environmental manager  than it is a package manger. A package manager is simply a software tool used to automate the process of installing , updating  and removal of software packages(libraries). Conda PIP Can install non-python libraries Can only install python libraries Cross platform package manager Python package manager Install python packages in conda-environment Install python packages in any environment Leave any other disparities in the comments section below,so they can be added to the list.

How to formulate your own thesis topic

Formulating a thesis topic based on your personal interests should not be too hard! Simply conduct a self assessment and find out what areas in your field interest you most. Thereafter,do the following:

How to install python pip

Install pip using get-pip.py 1. If you haven't installed python already: $ sudo add-apt-repository ppa:deadsnakes/ppa $ sudo apt-get update $ sudo apt-get install python3.6 2.   Get a copy of get-pip.py 2.1. The download will start automatically 2.2.  Navigate to the download folder in your terminal 2.3. Open terminal from here 2.4. Run $ python get-pip.py 3. That's it! Now you can easily install python packages. Examples: $ pip install jupyter $ pip install django==2.0 Install pip using python3 setuptools 1. Install setuptools on your linux machine $ sudo apt-get install python3-setuptools 2. Install pip using easy-install $ python -m easy-install pip Bonus If you get "$ error: command 'x86_64-linux-gnu-gcc' failed with exit status 1" Run the following: $ sudo apt-get update $ sudo apt-get install python3-dev $ sudo apt-get install python-dev $ sudo pip install jupyter

Too much abstraction

Abstraction refers to the method of 'hiding' implementation details in the process of software development. This technique is useful to prevent code duplication in a computer application. Usually, this is achieved by the use of libraries, packages or modules contained in the programming language core library or from external sources. So what is the issue here....... Too much of anything is umm... bad for you! Most new programmers grow up with little information concerning how most libraries work in the background Cloud computing eliminates the need for  hardware set up and low level machine configurations Modern programmers are mostly concerned with integrating several "black boxes" to create innovative and disruptive solutions - GREAT! "Essentially, we're progressing into an age where no one knows how to operate a manual transmission vehicles" - SAD! Potential issues What happens when the background code in the abstraction "...