Giter Site home page Giter Site logo

alexmhack / django-hosts-awseb-boilerplate Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 25 KB

Using Django backend with django-hosts and deploying using AWS ElasticBeanstalk

Python 60.09% HTML 39.91%
django2 tutorial django-hosts boilerplate elasticbeanstalk aws subdomains deploying-django

django-hosts-awseb-boilerplate's Introduction

Django-Hosts-AWSEB-Boilerplate

Using Django backend with django-hosts and deploying using AWS ElasticBeanstalk

What django-hosts does is allows you to use subdomains in your django website for example a seperate subdomain for the app help like help.example.com or blog.example.com. You can have as many subdomains as your apps in your django project.

Follow the steps from this repo for launching elastic beanstalk environemnt inside a VPC. After finishing those steps continue from below.

I am uinsg pipenv for my virtualenv you are free to use of your choice, active pipenv virtualenv by running pipenv shell.

  1. Install django-hosts in your virtualenv pip install django-hosts

  2. You can directly get the sample code for a running django-hosts enabled django project from this repo Or just follow the steps below to install django-hosts in your django project.

  3. Now follow the installation steps stated out here.

  4. Create a hostsconf folder in your project folder containing settings.py file. Add three files in this folder namely,

    1. init.py
    2. urls.py
    3. views.py
  5. Your files should have these pieces of code in it,

    1. For urls.py
    2. For views.py

    Click on the raw button and copy paste the code.

  6. Now create a hosts.py file alongside the settings.py file with this piece of code.

    For further explanation of what's happening inside these files you visit the official docs

  7. Assuming you have your elastic beanstalk environment ready, if not follow these steps. Run eb status and copy paste the whole CNAME: xxxxxxxxxxx in your ALLOWED_HOSTS settings.

  8. Create additional apps for the project by running python manage.py startapp blog python manage.py startapp help Add these to the INSTALLED_APPS

  9. Run eb config if not to change the WSGIPath to our boilerplate/settings.py file.

  10. Add some templates and use the django-hosts template tags like the templates in this repo. To use the urls don't forget to add PARENT_HOST setting as explained here

  11. Run eb deploy and test out the site, if you have your domain available, attach it to your environment and enjoy the use of subdomains with your domain.

NOTE: I have tested this project in my local machine by editing the etc/hosts folder and pointing my localhost to djapp.com. You can do the same with the elastic beanstalk env url by adding the subdomains to the ALLOWED_HOSTS appended by the subdomain for example blog.elastic_benstalk_url.com

django-hosts-awseb-boilerplate's People

Contributors

alexmhack avatar dependabot[bot] avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.