-1

I am a front-end web developer learning Python and decided to try to create a website for a friend. The website contains an astrology calculator that will generate a chart image and reading based on a person's birth date, birth time, and birthplace. I can use either Python CGI or Django to build this. Which one is appropriate for this project?

The chart calculator will:

1. generate an image of a chart with the correct houses and signs lined up.
2. plot the planets in the correct houses in the chart
3. show the connections between the stars, like a trine, square, or conjuction.

To render images, I think HTML5 can probably work. For the server-side scripting I am leaning towards CGI because it seems like you can write real Python programs with it and just output the results with something like print "sun conjunct jupiter". Django seems to limit you to that weird syntax that forces you to write every Python expression in these <% ... %> brackets and it doesn't seem like you can import Python modules easily.

I am not extremely familiar with Django, but these seem to be some of the limitations I noticed in the Django tutorial.

What do others in the community think? Should I use CGI or Django to create this website?

I checked out other questions, but not sure if a Python mini-framework is appropriate here.

Foure
  • 3
  • 2
  • Django templates have limitations for a good reason: it is usually good idea to separate logic from presentation. For your task (generating a single HTML page) Django might indeed be an overkill. The big selling point of Django is its ORM and its admin interface which you would not need. So you could probably do well with simpler framework like `Flask`, `Bottle`, or `web.py` – Pēteris Caune Feb 18 '15 at 00:59
  • 1
    possible duplicate of [My first web app (Python): use CGI, or a framework like Django?](http://stackoverflow.com/questions/10777502/my-first-web-app-python-use-cgi-or-a-framework-like-django) – Pēteris Caune Feb 18 '15 at 00:59

1 Answers1

0

Not really sure what you're hoping to glean from this (or what the question is exactly), but you seem to be misinterpreting what the Python CGI functions and Django are.

Django is a web framework meant to expedite the process of developing a website, so you can focus on specific issues (like the chart problem you described) rather than have to tend to the infrastructure of a site. It's meant to abstract away CGI (to oversimplify it a bit). If you're looking for something less heavy than Django, perhaps try Flask or Bottle.

PS: A quick Google search showed a similar question from a few years back: My first web app (Python): use CGI, or a framework like Django?

Community
  • 1
  • 1
  • What if you need to do some complex programming on the server side, like calculate leap years starting from 1800 or a set of different math equations to calculate which house each planet should fall in? In my python program I have at least 100 lines of code. I may be misunderstanding the purpose of Django. How would I generate the results of these complex calculations? Would it be run as a normal .py file on the web server then its results are output to a database and I use a web framework to pull this data into a web page? – Foure Feb 18 '15 at 01:13
  • @Foure You can put whatever code you want into the Django view (known as the "controller" in other frameworks). The "weird syntax" you mentioned is only for Django templates. You are in no way limited in what Python code you execute on the server if you go with Python. – nakedfanatic Feb 18 '15 at 02:39
  • 1
    @nakedfanatic: Ah I see! That was the missing piece of the puzzle that I didn't pick up in the Django tutorial! Thanks!! – Foure Feb 18 '15 at 03:09