DEPLOYING DJANGO ON A SHARED HOSTING – LEARNING BY DOING

Django is a Python-based framework that enables quick and easy create powerful websites. Quick and easy is neither here nor there, unless you are one of the few who finds fun in programming. You must be in love with programming and has become a sure reference material for programming cookbooks and cheat sheets to get it quick and easy.

?For proponents of free and open-source software movement, Django is another stunning product and still improving.

?Learning by doing is a theory of education. It's a hands-on approach to learning, meaning students must interact with their environment in order to adapt and learn. Competency based learning cannot be illustrated ant better especially with a working product as an output alongside knowledge and competency.

In the programming space I have ever applied learning by doing to drill my knowledge and competency deep into emerging programming tools, platforms and paradigms specifically Android, Java, Python.

?In web programming you must develop cordial and professional friendship with HTML and JavaScript. For example, you need to nicely talk to JavaScript to allow you to render a geojson object on a webpage, after you agree HTML will be waiting for you with a big smile.

1.??HOSTING A DJANGO APPLICATION/WEBSITE.

Most hosting providers don’t offer Django on their shared hosting packages, instead they have it on the managed packages and managed means more money.

Some of the hosting providers that offer Django on the shared packages don’t offer support, you do it yourself and handle any troubleshooting or debugging that maybe required on your own. So you must be a guru or get a guru of Linux, Django and Django dependencies with databases, apache etc. Actually in my review I never came across a shared hosting package which offers Django with support, maybe they are there.

I finally settled on A2 Hosting. Me and Linux, Django and all these emerging tools have mutual understanding so very minimal challenges getting along.

2.??DEPLOYING DJANGO ON A2 HOSTING SHARED ACCOUNT.

I will not go deep into the deployment details but I will give a high level outline of my hands-on experience. By the tie you are reaching this stage of production deployment you must have developed a working Django application. Django development environment comes with a lightweight web server which enables testing.

At this point you have secured a hosting package from A2 Hosting. You have your account and access details; you have a domain.

Django provides a tool to run pre deployment checks to ensure your application is ready and secure for production. This you can run in your final development version and or in the production. The output is a recommendations of settings to be fixed.?

  • Setup a domain. You can choose to deploy at the root domain or create a subdomain.
  • Python setup: This is actually installing python on your domain, you specify the version among other details. It gives you a link to your virtual environment which you need to save as it will be required later to activate the virtual environment.
  • Create the database: You can create the database at this point if required, you have a choice of PostgreSQL (this is what I used), MySQL, SQLite.
  • Install Django and configure the application (project). You can basically create a project with the same name as your development project then zip the development folders, upload them into the production and unzip. You may not need to recreate the apps again in production. If you need a different setup for static files (images, JavaScript, or CSS), you can create folders at this stage.
  • Perform settings changes: Several are required by production e.g. Urls.py. Settings.py, passenger_wsgi.py.
  • Perform migrations: Run the Django command for migrations.
  • Create superuser.
  • Collect the static files: Unlike in development, serving static files in production can be a little bit nerve wracking. In development Django serves them but in production Django expects the webserver to serve them. You may also want to serve static files from the same location (server) of your Django application.
  • Go live! Restart the application in the control panel. Pen the URL pf your application/website and you should be very live.

You can sample my product in the link below. If you are Kenyan, you can zoom into your rural home.

https://consulting.datapathcfcl.com/Pres_Results/

3.??DJANGO AND OTHER WEBSITE DESIGN TOOLS

Django works well with other website design tools. You just need to have a good understanding of the framework to know how to transfer the files from those other tools. For example, if you use nicepage to design, you simply transfer the HTML files, JavaScript files, Images, CSS files to where Django expects them and your pages works seamless.

Okech Edward

Seasoned applications developer with team & projects management enthusiasm | Scrum, ITIL V4, PMP

2 年
回复

要查看或添加评论,请登录

社区洞察

其他会员也浏览了