Automatically updating Django website hosted on PythonAnyWhere server with every git push

Until now this is how I use to develop and deploy (update) code on PythonAnyWhere server.

  1. Make changes in code on my local machine.
  2. Commit and push the code to remote repository.
  3. Login to PythonAnyWhere server and start bash terminal.
  4. Pull the code from remote repository.
  5. Reload the web app from web tab.

Steps 3 to 5 are time consuming, repetitive and boring. So I thought of eliminating these steps.

In this article we will see how can you get rid of these steps and your web site is automatically updated with the code as soon as you push it to remote repository.

Continue reading “Automatically updating Django website hosted on PythonAnyWhere server with every git push”

How to setup Django app on EC2 instance (AWS) – Part 2

In the previous part of article we completed the environment setup to host the Django app on EC2 instance of AWS.

How to setup Django app on EC2 instance (AWS) – Part 1.

Hosting Django Apps on PythonAnyWhere server for free. Step by step guide.

In this article we will start from where we left in last part.

Database initialisation:

Activate the virtual environment.
source venv/bin/activate

Make migrations.
python manage.py makemigrations

If you get a message –  No changes detected then make sure migration files from development environment are not present. If still same message is received, mention the name of app with makemigration command.

Continue reading “How to setup Django app on EC2 instance (AWS) – Part 2”

How to setup Django app on EC2 instance (AWS)

Recently I hosted Django project on EC2 instance of AWS. I find the process very difficult due to multiple reasons which we will see in article.

Hosting on PythonAnyWhere is cake walk as compare to hosting on EC2 instance. And pricing is also almost same.

Since I have gone through the process, I am sharing the step by step approach to host Django application on EC2 instance.

 

Steps to host Django app on EC2:

Login:

Create the account and get the .pem file.

Place the file in on your system and change the permission on that file to 644.  chmod 644 aws_key.pem

Login to system from terminal.  ssh -i aws_key.pem ec2_user@ec2-232-999-89-1.compute-1.amazonaws.com

Now you are into your home directory. Running pwd  will give you  /home/ec2-user .

Continue reading “How to setup Django app on EC2 instance (AWS)”

How to integrate PayUMoney payment gateway in Django

In this article we will see how to integrate PayUmoney payment gateway in your Django app.

Steps:

– Register with PayUMoney.Com as seller/merchant. Fill your details in the form and submit.
– Select the product Payment Gateway.


– On the next screen select your Business filing status, Business Name and kind of business. Name of Bank Account Holder should be same as Business Name.
– Similarly complete the next few steps and get your salt and keys.
– You will need to provide your PAN card details, Bank Account Details and Address for account to activate.
– Once above details are provided, you will receive a confirmation call from payumoney and you will require to send the document to them. After that your account will be fully active.

Continue reading “How to integrate PayUMoney payment gateway in Django”

Python Script 1: Convert ebooks from epub to mobi format

We are starting a series of python scripts which we may use in our daily life to automate mundane task and save some time.

This is the first article in this series. Recently I bought Amazon’s Ebook Reader, kindle paperwhite 3. I purchased few books from kindle store and downloaded most of the books in Epub format. Now kindle doesn’t support epub format. You need to convert them to either mobi or azw3 format.

Continue reading “Python Script 1: Convert ebooks from epub to mobi format”

How to upgrade to paid account on PythonAnyWhere

When I started developing Django applications, one constant concern I had was ‘which is best server for hosting Django applications?’.  I read multiple articles about hosting the Django app, hosting service providers and server providing Django support. Most of them provides support for python but very few provide support for django.

I even purchased hosting space on two servers but thanks to money back guarantee scheme, my money was returned as I was not satisfied with their service. Finally I settled for PythonAnyWhere. I liked PythonAnyWhere for its simplicity.

Continue reading “How to upgrade to paid account on PythonAnyWhere”

How to use Google reCAPTCHA in Django

Using Google reCAPTCHA in Django forms is one of the best way to prevent login attack in your Django application. Although you may deploy other measures like blocking user after 3 unsuccessful attempts or blocking the IP address but I think reCAPTCHA is one of the most widely used method to stop bots from attacking your login/sign-in page.

In this article we will see how to use Google reCAPTCHA in Django forms.

Continue reading “How to use Google reCAPTCHA in Django”

How to share data between two systems using python simple HTTP server

Consider this, you want to share files between two system or you want to send really large file to your friend or you want to share new season of ‘The big bang theory’ among your peers. What if you do not have pen drive with you. What if file size is larger than pen drive capacity? What if you have some file which is required by 100 people.

Python Simple HTTP server comes to the rescue. Using a one line command in your terminal you can overcome all limitations discussed above.

Continue reading “How to share data between two systems using python simple HTTP server”

How to send bulk emails for free using Mailgun and Python Django

Consider these scenario in your newly developed Django Application:

  • You need to send promotional emails to all the registered users.
  • You need to send email confirmation link or password reset link.
  • You need to send weekly newsletter to you readers.

What do you choose? Free Gmail Account to send email using python code? That is a nice idea provided you want to look unprofessional and you need not to send more than 500 emails per day.

But if you want professional look in your emails [from address something like admin@yourwebsite.com  instead of something@gmail.com  and do not want the limit on per day email count, then this article is for you.

Continue reading “How to send bulk emails for free using Mailgun and Python Django”