Thursday 15 September 2016

Basic Git commands



> git config --global user.name "your user name"
> git init
> git add .
> git commit -m "comment here"
> git remote add origin URL
> git remote -v
> git push origin master

Thursday 3 March 2016

Deploy Django app on Heroku (Quick Guide)

Heroku is a platform as a service type cloud. It supports many languages like -

Python    |    php    |     Go   |     Scala    |     Ruby on Rails    |  Node.js   |    Java

 

 

 Here i am discussing about how to deploy your django app on heroku. So I am considering that your django app is ready to deploy...

 

Things you should learn before deploy -

1 - PostgreSQL (Heroku only support postgresql ,it must be installed locally on PC).

2 - Virtualenv (It creates a virtual environment, which separates required dependencies from all installed dependencies ).  [  pip install virtualenv ]

3 - Procfile (It is a simple text file , which declares the command to start the app).

4 - Dynos , requirement.txt file.

5 - Git and Github.


Steps to deploy -  

> Download HEROKU-TOOLBELT from heroku website.

> Open the heroku CLI and run these commands ---
       
$ git clone https://github.com/heroku/python-getting-started.git
$ cd python-getting-started
> It will create a folder in your local machine along with requirement.txt file.
        Folder PATH in local machine -- C:\Users\shivam\python-getting-started

> Create app on heroku cloud with random name - ( Ex - lit-bastion-5032)

$ heroku create
Creating lit-bastion-5032 in organization heroku... done, stack is cedar-14
http://lit-bastion-5032.herokuapp.com/ | https://git.heroku.com/lit-bastion-5032.git
Git remote heroku added
> Now push your project to heroku -
$ git push heroku master
Counting objects: 232, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (217/217), done.
Writing objects: 100% (232/232), 29.64 KiB | 0 bytes/s, done.
Total 232 (delta 118), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: -----> Installing python-2.7.11
remote:      $ pip install -r requirements.txt
remote:        Collecting dj-database-url==0.4.0 (from -r requirements.txt (line 1))
remote:          Downloading dj-database-url-0.4.0.tar.gz
remote:        Collecting Django==1.9.2 (from -r requirements.txt (line 2))
remote:          Downloading Django-1.9.2-py2.py3-none-any.whl (6.6MB)
remote:        Collecting gunicorn==19.4.5 (from -r requirements.txt (line 3))
remote:          Downloading gunicorn-19.4.5-py2.py3-none-any.whl (112kB)
remote:        Collecting psycopg2==2.6.1 (from -r requirements.txt (line 4))
remote:          Downloading psycopg2-2.6.1.tar.gz (371kB)
remote:        Collecting whitenoise==2.0.6 (from -r requirements.txt (line 5))
remote:          Downloading whitenoise-2.0.6-py2.py3-none-any.whl
remote:        Installing collected packages: dj-database-url, Django, gunicorn, psycopg2, whitenoise
remote:          Running setup.py install for dj-database-url: started
remote:            Running setup.py install for dj-database-url: finished with status 'done'
remote:          Running setup.py install for psycopg2: started
remote:            Running setup.py install for psycopg2: finished with status 'done'
remote:        Successfully installed Django-1.9.2 dj-database-url-0.4.0 gunicorn-19.4.5 psycopg2-2.6.1 whitenoise-2.0.6
remote:
remote:      $ python manage.py collectstatic --noinput
remote:        58 static files copied to '/app/gettingstarted/staticfiles', 58 post-processed.
remote:
remote: -----> Discovering process types
remote:        Procfile declares types -> web
remote:
remote: -----> Compressing...
remote:        Done: 39.3M
remote: -----> Launching...
remote:        Released v4
remote:        http://lit-bastion-5032.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To git@heroku.com:lit-bastion-5032.git
 * [new branch]      master -> master

> Running app with scale web=1  
$ heroku ps:scale web=1

 > Congratulations ....app is deployed NOW.
     Run this command to open your app in browser.
$ heroku open

Wednesday 25 November 2015

HOW TO MAKE GOOGLE CHROME EXTENSION -















2 - Now you need 4 files to create your own extension
      a)- icon.png (image must be in png format).
      b)- popup.html (This is the display page).
      c)- popup.js (An external javascript file .... *inline javascript is not supported in extension).
      d) -manifest.json(It contains information about your extension).













3- Download the sample repository from this link - https://developer.chrome.com/extensions/getstarted

4- Create a folder and copy these 4 files in the same folder.

5- LOADING YOUR EXTENSION
    a)- Open Google Chrome browser.
    b)- Go to settings>>extensions.
    c) - Click >[load unpacked extension] . 
    d)- Browse your folder.





CONGRATULATIONS !!! 
NOW YOU HAVE YOUR OWN GOOGLE CHROME EXTENSION.

Monday 20 April 2015

Adding Google maps on your webpage...(javascript API)

>>>>> click on this link - https://developers.google.com/maps/web/ 

 
GOOGLE MAPS API
>>>>>click on the ( get started with the javascript API V3 ) button.


>>>>>copy and paste the above HTML CODE  on your notepad.

>>>>>Now you just need a API_KEY to copy in your HTML CODE.

>>>>>click on this link - https://developers.google.com/maps/documentation/javascript/tutorial#api_key

>>>>>follow the steps showing in below image. 

>>>>Copy the API KEY & replace it from the text (API_KEY) in HTML code.

Shivam Kumar Chauhan - Web developer