検索 - みる会図書館

全データから 910件ヒットしました。

Two Scoops of Django Best Practices for Django 1.8


Beginner Python MateriaI Learn Python the Hard Way http://amzn. to/100YqYv If you don't know Python, this is one of the best places to start. FIhe author takes you through Python the same way he learned guitar, through rote and repetition. Don't worry about the title, this is a good way to get started with python. Learn Python the Hard Way On1ine Edition http: //learnpythonthehardway. org/ By going right to the source, this free for HTML, paid for video resources, is one of the best places tO start. "lhe video resources are especially useful. Automate the Boring Stuffwith python amazon . C0m/gP/Pr0duCt/1593275994 'lhis fascinating book teaches python by instructing on how to make boring computer tasks easy through automation. Why update 150 columns of a spreadsheet when python can dO it for you? UsefuI Python MateriaI Effective Python http://amzn. to/1NsiqVr lnstructs on many useful practices and techniqueswhen coding in python. Python C00 00k , 3rd Edition http://amzn . to/13Sv6q An incredible book Python luminaries David Beazley and Brian Jones, it's filled with delicious recipes... err... incredibly python recipes Python 3.3 or greater. Treading on Python VoIume 2 http://amzn. to/1kVWi2a Covers advanced python structures. 、 vriting ldiomatic Python 3.3 http://amzn . to/1aS5df4 Great tips for optimizing your code and increasing the legibility of your work. FIhere are a few places it differs 伝 om our practices (imports being the largest area ofdifference), but overall 、 concur. イ 67

Two Scoops of Django Best Practices for Django 1.8


CO 〃 〃 倉 B eginner Python M aterial Useful Python Material JavaScript Resources Appendix D: lnternationalization and Localization Start Ear1y . Wrap Content Strings with Translation Functions . Don't lnterpolate Words in Sentences Browser Page Layout Appendix E: Settings Alternatives Twelve Factor-Style Settings Appendix F: 、 vorking with Python 3 Most CriticaI Packages Work with Python 3 . Use Python 3.3.3 or Later . Working With Python 2 and 3 R. esources Appendix G: Security Settings Reference Cross Site Request Forgery Protection Settings Email SSL . SESSION-SERIALIZER Acknow1edgments List ofFigures List ofTab1es lndex X'Z ″ . 461 . 461 . 462 463 . 463 . 464 . 465 . 468 471 . 471 473 . 473 . 475 . 475 . 476 477 . 478 . 478 . 478 479 484 487 489

Two Scoops of Django Best Practices for Django 1.8


CO 〃 〃 倉 B eginner Python M aterial Useful Python Material JavaScript Resources Appendix D: lnternationalization and Localization Start Ear1y . Wrap Content Strings with Translation Functions . Don't lnterpolate Words in Sentences Browser Page Layout Appendix E: Settings Alternatives Twelve Factor-Style Settings Appendix F: 、 vorking with Python 3 Most CriticaI Packages Work with Python 3 . Use Python 3.3.3 or Later . Working With Python 2 and 3 R. esources Appendix G: Security Settings Reference Cross Site Request Forgery Protection Settings Email SSL . SESSION-SERIALIZER Acknow1edgments List ofFigures List ofTab1es lndex X'Z ″ . 461 . 461 . 462 463 . 463 . 464 . 465 . 468 471 . 471 473 . 473 . 475 . 475 . 476 477 . 478 . 478 . 478 479 484 487 489

Two Scoops of Django Best Practices for Django 1.8


Use Python 3.3.3 0 「 Later Django is a large, complicated system. 、 Mhile it's heavily tested for multiple versions of pyth on 3 , we've found that it just works better with more recent versions ofthe language. For example, mi g rate fails in curious ways with Python 3.3.0. Working With Python 2 and 3 We usually encounter this scenario when we are writing a third-party package for use in Django or even Just vanilla Python. However, there are use cases where an entire Django project might be deployed to Python 2.7 as well as python 3.3. Fortunately, most ofthe following suggestions 叩 p ツ no matter the scale of the project. Tests and ContinuousIntegration If there isn t a working test harness and functioning continuous integratl()n, no 、 is the time to set it up. Testing compatibility across major python versions simply requires automation. Keep CompatibiIity MinimaIIyInvasive %e last thing that a project needs is complex branches to deal with different versions ofPyth lherefore, use the following imports at the top of a python module to keep code identical: E 強 M も E 35 ・ 14 # The __future_— imports in this modute means that ・ a11 code in this exampte witt work identicalty in python 2.7 and に # Python 3 or higher. on. # Mu1ti —Line and Abs01ute/Retative imports work identicatty across # Python versions. from ___future import absolute_import # Any division witt return ftoat objects. Exampte / 2 = 1.5 from __future__ import division 475

Two Scoops of Django Best Practices for Django 1.8


C み 4 ア / 35. ・ / ア 臾 砌 市 % リ 防 切 g ″ ん ん 〃 3 When 、 do need more complexity or any sort OflogiC' that's 、 it s time tO create a ( 0 ア 4 ー ア ッ module. # A11 strings defined in python 2 and 3 can use python 3 name = tdjangot # syntax for defining unicode¯friendly strings ・ from __future—— importe Use django. utils. encoding. pythonü unicode-compatible in M0deIs Rather than write both —st r— ( ) and —uni code—( ) meth()d* use django. utils. encoding. python-2-unicode-compatibIe SO it only has to be written once. see section 19.3,'Viewing string Representations Of Objects. Resources lhe following are useful resources for Python 3 topics: Porting to Python 3 http://python3porting. com/ Lennart Regebro's free HTML or paid e-book bundle on the subject of moving 伝 om Python 2 to 3. Porting Django apps to Python 3 http: //youtu . be/cJMGvAYYUyY %is is Jacob Kaplan-Moss' PyCon US 2013 video on the subject. Python C00kb00 3rd Edition http: //amzn. t0/13Sv6q David BeazIey and Brian Jones' book of handy recipes for Python 3. 、 vriting ldiomatic Python 3.3 http://amzn. t0/1aS5df4 Jeff Knupp's guide to writing Python 3 code the'right' way ・ イ 76

Two Scoops of Django Best Practices for Django 1.8


C み 4 ア た r27 ゞ 12 ノ 4 〃 g & 冴 立 e• ・ 耘 ィ ー り 2 ん g お ( I 月 0 270 Django packages are downloadable 伝 om the PYthon Package lndex in addition to pip ・ release of Django, pip downloads the files 伝 om the python package lndex. Most PYthon and center for python package information and files. Whenever メ ou use pip to install a particular lhe python package lndex is much more than just a directory of it as the world's largest until it occurs on the Python Package lndex. For the vast majority ofPyth on community, open is 0 一 石 ci it lists over 55 , 000 packages, including Django itself• itory ofsoftware for the python programming language. As ofthe time this sentence was written' ThePythonPackageIndex(PyPI).Iocatedathttps://PYPi ・ python.org/pypi'isarepos- 21.2 Know About the Python Package lndex prefixed with django-", but there are many exceptions. ) of them in other python projects. (GenerallY' l)jango-specific packages generally have names Note that not 砠 of those packages are l)jango-specifi% which means that you can use some packages to consider adding to your projects ・ out Two scoops of Django. lhis list is a great starting point ifyou're looking for highly-useful Appendix A: ル c ん g お イ 砌 石 記 ル な ル covers all of the packages mentioned through- 21.1 ExampIes 0fThird-Party Packages Figure 21.2 : 第 secret is out. lt's just hot fudge.

12歳からはじめる ゼロからの Pythonゲームプログラミング教室


12 歳 か ら 覚 え る Python Cha e 「 や テ キ ス ト エ テ イ タ ー な ど を イ ン ス ト ー ル し て プ ロ グ ラ ミ ン グ を 始 め ま し よ う 。 と い う と こ ろ か ら 、 本 書 の 説 明 を ス タ ー ト し ま す 。 そ れ が 終 わ っ た ら 、 Python Python は 現 在 人 気 急 上 昇 中 の プ ロ グ ラ ム 言 語 で す 。 そ の 人 気 の 理 由 は な に ? Python を は じ め よ う

Two Scoops of Django Best Practices for Django 1.8


Appendix F: Working with Python 3 l)jango's 0 ー 五 ci documentation has a well-written page that covers much of what's involved with working with Python 3. Here are some specific sections you should pay careful attention to : DjangoOfficialDocsonPython3 http://2scoops. C0/1.8-python3 CodingGuidelines http://2scoops. C0/1.8-python3-coding-guideIines 、 VritingCompatibIeCodewithSix http://2scoops. C0/1.8-python3-six Here are some other things you should ow. Most CriticaI Packages Work with Python 3 As of the time of this writing, Django packages lists over 205 packages that support python 3. %is includes such critical libraries as: Django itself Pi110w django—braces django-crispy-forms django-debug-toolbar django-floppyforms django-rest-framework python-requests youcanseealistofl)jangospecificlibrariesathttps: //www. djangopackages.com/python3/. 473

Two Scoops of Django Best Practices for Django 1.8


Provides a number of additional generic class-based views to complement those provide 域 Django itself. django-vanilla-views http://django-vanilla-views. org/ Simplifies Django s generic class-based views by simplifying the inheritance chain. Time python-dateutil https: //pypi ・ python ・ org/pypi/_python-dateutil Provides po 、 4rer 丘 11 extensions to Python's datetime module. pytz https://pypi . python. org/pypi/pytz/ Brings the Olson tz database into Python. lhis library allows accurate and cross platform timezone calculations. lt so solves the issue of ambiguous times at the end of daylight saving time. Library Reference Miscellaneous awesome-slugify https: //pypi . python. org/pypi/awesome—stugify A flexible slugify function. dj-stripe https://pypi ・ python. org/pypi/dj-stripe Django + Stripe made easy. django-compressor http: //django-compressor. readthedocs. org/ Compresses linked and inline JavaScript or CSS into a single cached file. django-extensions http: //django-extensions. readthedocs. org/ Provides shell-plus management command and a 10t of other utilities. django-haystack http: //django-haystack. readthedocs. org/ Fu11-text search that works with SOLR, Elasticsearch, and more. django-pipeline http://django-pipetine. readthedocs.org/ Compression of CSS and JS. Use with cssmin and jsmin packages. django-htmlmin https://pypi . python. org/pypi/django-htmlmin HTML minifier for django. django-reversion https://pypi . python. org/pypi/django—reversion An extension tO the Django web frame 、 that provides comprehensive version control facilities. django-watson https://github. com/etianen/django—watson FuII-text multi-table search application for Django using SQJu database features. 457

Two Scoops of Django Best Practices for Django 1.8


C ろ 4 ア / 35. ・ / ア ア 砌 イ ⅸ F• ・ 曻 房 を 〃 gw 2 ん 〃 3 Checking f0 「 Python 3 Compatibility Here are the steps we 応 Ⅱ ow in rough order when determining if a third-party library actually works with Python 3 : Checkon https://www.djangopackages. com/PYthon3/. Look up the package on pyPl and see if any of its trove classifiers mention Python 3 status. See if a pull request for python 3 support is outstanding. Run the test suite using Python 3.4. If a Django project, check the models for —st r— ( ) methods. If it has them' it's a pretty good indicator that it's Python 3.4 friendly. Converting a Library t0 Workwith PYthon 3.4 How we convert Python 2 code to Python 3 : Get the test harness working with Python 3. Lean on dj ango ・ contri b. si x as much as possible. Add a ( 0 襯 ア 可 ・ カ , module only if absolutely needed. Fix any problems you find in the code. Try to keep solutions as simple as possible. S ubmit the pull request ・ politely poke the package owner to accept the pull request. Once the owner accepts the pull request' gently poke the package owner to push the update to PyPI. TIP: DeaIing with ow Maintainers Ranting tO or complaining about S10 、 M-movmg maintamers is absolutely counter- productive. people have lives and jobs that sometimes get in the way 0f open source ・ lt's more productive t0 be patient' be polit% and if necessary d0 an absolutely minimal fork or find a working alternative. イ 74