[Python] My Overview of Django

来源:互联网 发布:数据大魔王txt下载 编辑:程序博客网 时间:2024/05/22 10:54
How to parse the ini file ?

The ConfigParser class will read the configuration file and parse them as dictionary.Therefore,It is easy to get the entry from your desired section. This solves the configuration issue in the Python world

The constant variables and global variables

You can use the global keywords to make the local assignment globally

There are two pieces of settings in the Django. One is the global settings and the other is user custom settings.Django uses different ways to load these two kinds of configurations. In order to achieve the purpose of user settings overriding the global settings, the Django stores the user setting file into operation system's environment variable and loads this module dynamically when merging all of the settings.

How does Django resolve the URL mapping?

It uses the regular expression to link the URL to view functions

class klass(object):    name = "developer"        @property    def skill(self):        return 'Python'        def skills(self):        return " ".join(["HTML","Django"])if __name__ == '__main__':    print klass.name        print klass.skill          print "See how they are different"        instance = klass()        print instance.name    print instance.skill    print instance.skills()


0 0