Skip to content

Latest commit

 

History

History
330 lines (244 loc) · 13.3 KB

Raspberry Pi, python3.4, Django development notes.md

File metadata and controls

330 lines (244 loc) · 13.3 KB

Upgrading Python3 & running Django on Raspberry

http://www.quora.com/Lean-Startups

Everyday Django Resources:

Some useful concepts / topic:


Django Tutorials

Laravel official doc provides no tutorials (not like what django doc does nor rails guide does), I have to find it "outsite". -> Google: laravel guide | laravel cast

How to find tutorials?

  • Google: django tutorial | django guide | django cast | django girls | django girls tutorial
  • Quora: how to learn django
  • Google: Laravel ?株?????

Django bulid a blog

Django Blog example

Restful

Class based view

View & Template

How do I explore & setup a sandbox environment for python development

Google: virtualenvwapper

使用virtualenv创建虚拟python环境

Linux下使用Virtualenv搭建Django开发环境 shows how to use pip freeze to rebuild the python environment in development, soon or later in future.

pip freeze > prj.txt

pip freeze -r prj.txt

搭建基于virtualenv的python 2.7开发环境 - python shows how to upgrade to python 2.7 from 2.6. I might do this to upgrade to 3.3 from Pi's 3.2 also.


或許我應問得更直接: Google: Raspberry python3.3 django

Django 1.5, Python 3.3, and Virtual Environments runs Fedora 17 which ships with Python 3.2, Python 3.3 had to be installed from source. The author installed it into his home .local directory. Then, he used a virtual envirnment to install Django 1.5.

http://pydanny.com/experiences-with-django-python3.html


Google suggests me to search with "raspberry pi django nginx"

Google: raspberry pi django nginx

The 2nd link Setting Up Django On a Raspberry Pi


how to set up a good project "skeleton" directory

What is the suggested project structure with virtualenv? (Should I place my django projects inside the virtualenv created folder? Or should I keep my projects away from the virtualenv folder? Does virtualenv affects how I structure my folders comparing to not using it?)

Google: virtualenv project structure

""I never place files inside the virtualenv directory. Virtualenv need have no impact on your project structure; just activate the virtualenv (or use its bin/python), and work on your files wherever you'd have them anyway. – Carl Meyer Nov 23 '09 at 20:31""

there's no requirement to locate your application within a virtualenv directory. For example, you might have a project where you have multiple applications using the same virtualenv.

ref:


Should I use generic foreign key, and how?


One table for diff type of category products


Creation of dynamic model fields (dynamic attributes)


Django self-referential foreign key


Code snippet

access from the shell: https://docs.djangoproject.com/en/dev/topics/db/models/ https://docs.djangoproject.com/en/dev/topics/db/queries/ from django.db import models

from product.models import * help(Topic)

get Queryset

t = Topic.objects.all() type(t)

get the 1st record

t1 = Topic.objects.get(pk=1) type(t1)

t1.source_set.count() # -> 16

t1.tags help(t1.tags) t1.tags.get_queryset() t1.tags.all()

Reuse "Material" info in pickup table

"Material" is a table column in the pickup table. The value of it maybe "cow skin", or "cow skin, plastic".

In order to min the data redundance, and save typing and free from typo, I am considering to reuse it.

That is, there are 2 solutions:

  1. I create a "materials" table, and make it in many-to-many relationship to "pickup" table.
  2. I make it a generic class, and then bind it to "pickup" table.

For 2:

For 1:


Tagging

Google: Django tagging


Comments

Google: django comment

Image management

image, gallery, media

Image / Gallery / Media Management

Extend models


South & Migration in Django 1.7

Google: should I use south in django 1.7

to reset the migration, run zerowith migrate

./manage.py migrate <app name> zero

Pre-populate database

Google: django fixture | django initial database


Auto complete

django-autocomplete-light


Address Book


Django Admin interface

Google: django admin 2

Google: django admin demo

Django bulid a blog


Django jquery Google: django jquery


Chart


Markdown

Static files


Render

Template

I have a queryset of Product Topic. Topics can be group by its status.

How can I display a group one after one in Django template?

Google: how to render queryset group by category in django template?

Futher: Google: send many queryset to template django

Django deployment


Maybe useful

[利用 Django 与 jQuery 回创建电子表格应用程序] http://www.verydemo.com/demo_c110_i5114.html

[利用 Django admin 完成更多任务] http://www.verydemo.com/demo_c288_i69887.html

https://github.com/phalt/DjangoPi A one-click Django installer for Raspberry pi.

http://xmodulo.com/2012/11/how-to-view-list-of-mysql-users-and-their-privileges.html

http://xmodulo.com/2013/04/how-to-fix-apt-get-update-error-on-ubuntu.html

「敗」站著工作環境敗家記錄

实例详解Django的 select_related 和 prefetch_related 函数对 QuerySet 查询的优化(三)

Starting a Django 1.6 Project the Right Way (from: http://blog.jobbole.com/53346/)

Google:productive infographic http://blog.visual.ly/10-infographics-to-help-your-productivity/

Google: rails cms http://designzum.com/2014/05/24/12-best-free-premium-wordpress-theme-frameworks-2014/ (from: http://designzum.com/2014/02/10/best-ruby-on-rails-content-management-systems-cms/, from Google: rails cms)