Where can I download a sample Django template? - python

I just started working at a place as a front end developer where I need to build Django templates. I never worked with these before, does anyone know where I can download a sample template so I can look through the code structure?
I won't be doing any application development using the Django framework, only taking the variables the developer gives me and incorporating the in the html/css templates I build.

There are lots of Open Source django apps that you could look at for inspiration. One example is Zinnia which is a blogging application - there are dozens of templates in this project, see this directory. There are many other open source django projects on http://github.com and http://bitbucket.org
You should also take a look at the official template documentation, there are lots of snippets there that are very useful.

Here's a nice little tutorial.
http://www.webmonkey.com/2010/02/use_templates_in_django/
Also, Check out the Django Docs.
http://docs.djangoproject.com/en/1.3/ref/templates/builtins/

Related

Deploy Sphinx docs on Django server

Recently I have been creating docs using sphinx. Now when the docs are done I want to deploy them on my web app under like /docs/ url.
Is here any good tool that is capable of doing that?
So far I found a tool that is able to deploy the docs under url but the docs look awful - it takes the json created by make and renders the data…
https://github.com/carltongibson/django-sphinx-view
Thanks for any ideas.

What do I need to know to make a basic Django website?

As the title states, I am curious what I need to know to make a website with Django.
My Attempts:
I am familiar with Python, but despite my attempts to begin work on a webpage(attempted some Django tutorials online and purchased "2 Scoops of Django" and started to work with some of its recommendations) I always feel like it points me at something else to learn. (PostgreSQL, git, virtualenv, VirtualBox, Vagrant, and more.) I understand that some of these are tools I just need to implement, but I feel as if I could delve into these much further and don't understand when I should stop trying to learn more about these.
My Goal:
I want to be able to develop a webpage with Django, and understand the steps and tools I am implementing.
My Question:
What tools do I need to learn, and how much about them do I need to learn to be able to begin working effectively with Django?
This is a very broad question but I can try to answer it as clearly as possible.
You said you are familiar with Python, that's a good thing. The next thing you should know is the MVC framework that Django is based on and uses extensively.
You can refer to Django tutorial here: https://docs.djangoproject.com/en/1.9/intro/tutorial01/ (as already mentioned)
I can give you a TLDR of how this can work:
1. Create a django project : $ django-admin startproject mysite
2. In the file structure that is created, the most important things would be:
a. models.py - your database models or schema defined as classes and objects
b. views.py - the view you are trying to display (mainly rendering .html in your case)
c. settings.py - you path, app setting, permissions, etc
d. urls.py - how you will be calling your specific views (redirect urls)
Once you write a basic app, try to run it using $python manage.py runserver and voila!
For the website part, there a few easy ways. You can download twitter bootstrap and try to attempt a simple page that you can find online with django http://getbootstrap.com/2.3.2/
As far as technologies go:
venv: is so that you do not mess up your other python, etc versions on your laptop, it isn't necessary
git: this is something you should learn irrespective of a project requirement. There are basic 3 commands that will be enough.
You might have to learn basics of HTML and CSS for manipulating your own website. Most of the backend can be handled on Django using objects of models you created.
Try these things out and let me know if you need anymore information.

Django directory plugin

Is there any Django plugin or reusable app available that we can use to add online directory feature to our Django based website?
You will not find something like that, because using django means you can do that with just a few lines of code by yourself. Django is not a CMS, but a framework, which means you are one level deeper. A lot of the things where you would use a plugin in a CMS are common tasks for django programmers, so there really is no need for a plugin to display such stuff as you mentioned.

Is there a folder layout structure for Django websites?

I am trying to get an overview of a Django website application structure. The way I have done this in the past with other frameworks (Symfony, RoR etc) is to look at the application folder structure, work out which bits go where, and then work my way on from there onwards.
I have been searching online for similar info about Django website folder structure - but have been unable to find one. Is there a recommended folder structure for Django apps? - and if yes, where I can obtain the document that details this?
Yes see
Folder structure for a Django project
also see
Writing your first Django app, part 1 - Creating a project
startproject script by default generates
mysite/
__init__.py
manage.py
settings.py
urls.py
Take a look at the tutorial on djangoproject.com - the directory structure is pretty clearly stated.
I think the philosophy was letting you have control over that. You can take a look at djangoproject's structure for inspiration:
http://code.djangoproject.com/browser/djangoproject.com/django_website

Example Facebook Application using TurboGears -- pyFacebook

I have a TurboGears application I'd like to run through Facebook, and am looking for an example TurboGears project using pyFacebook or minifb.py. pyFacebook is Django-centric, and I can probably figure it out, but this is, after all, the lazy web.
Why is pyFacebook django centric? Looks like it works perfectly fine with all kinds of WSGI apps or Python applications in general. No need to use Django.
pyFacebook is Django-centric because it includes a Django example. I did not intend to irk, but am merely looking for a TurboGears example using pyFacebook.

Categories