SlideShare uma empresa Scribd logo
1 de 90
Pinax Long Tutorial PyCon 2010
Introduction ~10 minutes
Who are we? - James Tauber Pinax Founder CEO of Eldarion http://jtauber.com
Who are we? - Daniel Greenfeld Pinax Core Developer Software Engineer for NASA's Science Mission Directorate Author/Instructor for Holden Web, LLC (holdenweb.com) Developer for Eldarion http://pydanny.com
Tutorial Prerequisites ,[object Object],[object Object],[object Object],[object Object]
History of Pinax 2008: James Tauber decides to stop repeating himself 0.5 — First official release 2009: First full year of Pinax 0.7 — Groups, Static Media, Move to pip and virtualenv, Section 508 2010: Today 0.9 — Next great thing
Philosophy of Pinax By integrating numerous reusable Django apps to take care of the things that many sites have in common, it lets you focus on what makes your site different. In other words... D on't  R epeat  Y ourself
What will we be doing? Installing Pinax Reviewing the core underlying layer Changing the look and feel Various Pinax tricks Building on what Python and Django gives us Deployment Community
Pinax Installation ~10 minutes
Where to get Pinax ,[object Object],[object Object]
virtualenv ,[object Object],[object Object],[object Object],[object Object],[object Object]
pip ,[object Object],[object Object],[object Object],[object Object],[object Object]
Core Underlying Components ~10 minutes
Core: Accounts Avatar Email Addresses Language OpenID Password Management Signup Timezone
Sign Up Options ,[object Object],[object Object],[object Object]
Core: Groups Groups in Pinax are containers with user membership and content. They are a base on which to write your own app and plug in whatever content apps you need. Examples: Tribes (Wiki, Photos) Projects (Tasks, Wiki) Guilds (Events)
Core: Static Media Handling css, images, javascript Project vs Pinax Theme vs App level Separation of static media from user-contributed media. build_static management command for deployment
Pinax Projects ~10 minutes
Overview of the starter projects ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Using pinax-admin List all the currently available projects in Pinax pinax-admin clone_project -l Cloning a project pinax-admin clone_project social_project djangofans
What is in a Pinax project? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Pinax specific settings.py ~5 minutes
Some Pinax Settings SITE_NAME (used in some default templates) CONTACT_EMAIL (used in some default templates) PINAX_THEME (prefix for template resolution) ACCOUNT_OPEN_SIGNUP (can anyone join?) ACCOUNT_REQUIRED_EMAIL (is email address required?) ACCOUNT_EMAIL_VERIFICATION (must email be verified?) EMAIL_CONFIRMATION_DAYS (how long before expiry?) LOGIN_REDIRECT_URLNAME (first page to go after login)
Media/Static Files Settings MEDIA_URL / MEDIA_ROOT     (URL and filesystem location for files uploaded/stored by Django only) STATIC_URL / STATIC_ROOT     (URL and filesystem location for site assets such as CSS, JS and images) SERVE_MEDIA      (Used in urls.py to hook-up MEDIA_URL and STATIC_URL used for development)
local_settings.py ,[object Object],[object Object],[object Object],[object Object],[object Object]
Modification of core  Pinax applications ~10 minutes
Profiles Frequently extended application You always want a custom field
Modification of core Pinax applications Before you change a core application: Can you accomplish your tasks with CSS? Can you accomplish your tasks with Javascript? Can you accomplish your tasks with template changes? Can you create a new application that does the work?
But my task needs a code/database change! pinax-env/lib/python2.x/site-packages/Pinax/pinax/apps/<app> pinax-env/src/Pinax/pinax/apps/<app> Don't make changes in Pinax itself!
But my task needs a code/database change! Option 1: Use the apps directory of your project cd apps/ django-admin.py startapp profiles Option 2: Use virtualenv/pip Create a stand alone app (best done eggified) pip install -e my-app
Adding Django applications ~10 minutes
Won't conversion be hard? Remember: Pinax is just Django with an opinion pip install <django-app> (Don't forget to add it to your requirements.txt file) make changes to INSTALLED_APPS, etc in settings.py make template changes
Modification of templates ~10 minutes
Customize templates, don't change them cp -r site-packages/pinax/templates/default/profiles my-project/templates Don't edit the Pinax templates directory!
Themes in Pinax Change your look and feel by just changing settings.py!  PINAX_THEME = &quot;default&quot; But only one theme is currently shipped with Pinax PINAX_THEME = &quot;default&quot;
Changing the logo Step 1: Add your image to <my-project>/media Step 2: In <my-project>/templates/site_base.html in the logo_link_image block change the name of the logo image to match your own. (but really you should be making more style changes than just the logo)
Handy Pinax template blocks ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Changing the look and feel ~10 minutes
base.html versus site_base.html ,[object Object],[object Object],[object Object],[object Object]
Adding and removing tabs ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Adding CSS In templates/site_base.html {% block extra_head_base %}:      <link rel=&quot;stylesheet&quot; href=&quot;{{ MEDIA_URL }}custom.css&quot; /> mkdir site_media mkdir site_media/media touch custom.css body {      background-color: #000; }
Changing Avatar defaults ~10 minutes
django-avatar by default uses Gravatar Pros: Gravatars follow a user's account name across the Internet Means users get a default avatar anywhere Cons: You might not want the default Gravatar avatar image You might not want to lock user avatars into a single service
Changing the default Gravatar logo In settings.py AVATAR_DEFAULT_URL =  STATIC_URL + &quot;<our_custom_avatar.jpg>&quot; AVATAR_GRAVATAR_BACKUP = False
django-groups ~10 minutes
What are groups? Groups in are containers with user  membership and content. Example: A project with tasks and wiki A guild with a forum and events
What does django-groups give you? ,[object Object],[object Object],[object Object]
Creating a group app ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Creating content object apps ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Looking at django-groups pinax-admin clone_project sample_group_project sgp cd sgp python manage.py syncdb python manage.py runserver
django-uni-form ~10 minutes
What is Section 508? ,[object Object],[object Object],[object Object],[object Object]
Why do we care? ,[object Object],[object Object],[object Object],[object Object]
Django forms rock!
Tables are for tabular data
In Section 508, some tabular forms are allowed
Out of the box pretty Django forms are tabular
Django Uni-Form =  Django forms docs + template tag + Uni-Form css/js forms library
Basic Usage
 
Advanced Django Uni-Form ~10 minutes
Making form generation easier {% load uni_form_tags %} {% with form.helper as helper %} {% uni_form form helper %} {% endwith %}
Adding action handlers {% load uni_form_tags %} {% with form.helper as helper %} {% uni_form form helper %} {% endwith %}
Media Handling ~10 minutes
Static Files ,[object Object],[object Object],[object Object],[object Object],[object Object]
Static media is good Caching Security Separating servers
build_static tool python manage.py help build_static Copy static media files from apps and other locations in a single location. --dry-run (don't copy but show what will be done) --link (create symlinks rather than copy) Project vs Pinax Theme vs App level
STATIC_URL ,[object Object],[object Object],[object Object],[object Object],[object Object]
STATICFILES_DIRS ,[object Object],[object Object],[object Object],[object Object],[object Object]
Serving Static Files During Development ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
JavaScript, jQuery and Pinax ~5 minutes
Why was jQuery chosen for Pinax? Because Pinax has an opinion But you can still use YUI, Mootools, or plain old JavaScript
Best practice for JavaScript use
django-ajax-validation ~5 minutes
django-ajax-validation In urls.py:      from my_app.forms import MyAppForm      (r&quot;^validate/$&quot;, &quot;ajax_validation.views.validate&quot;, {          &quot;form_class&quot;: MyAppForm,          &quot;callback&quot;: lambda request, *args, **kwargs:                   {&quot;user&quot;: request.user}      }, &quot;myapp_form_validate&quot;),
django-ajax-validation ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
django-pagination ~2 minutes
django-pagination ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Testing your Pinax application ~5 minutes
Why should you bother testing? &quot;Untested code is broken code&quot; Martin Aspelli &quot;Code without tests is broken as designed&quot; Jacob Kaplan-Moss &quot;All the cool kids are doing tests&quot; Chris Shenton &quot;If I go to another testing talk I'm going to die&quot; Daniel Greenfeld
Pinax Deployment ~10 minutes
What Pinax gives you ,[object Object],[object Object],[object Object]
Example Apache config ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Things to remember when deploying ,[object Object],[object Object],[object Object]
Community ~10 minutes
How to communicate ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Finding Help ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Contributing back ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Contributing back - Modular Efforts ,[object Object],[object Object],[object Object],[object Object]
Q & A

Mais conteúdo relacionado

Semelhante a Pinax Long Tutorial Slides

M365 global developer bootcamp 2019 Intro to SPFx Version
M365 global developer bootcamp 2019 Intro to SPFx VersionM365 global developer bootcamp 2019 Intro to SPFx Version
M365 global developer bootcamp 2019 Intro to SPFx VersionThomas Daly
 
Web Development in Django
Web Development in DjangoWeb Development in Django
Web Development in DjangoLakshman Prasad
 
Dev con pnp-engine-presentation
Dev con pnp-engine-presentationDev con pnp-engine-presentation
Dev con pnp-engine-presentationGautam Sheth
 
Python Django tutorial | Getting Started With Django | Web Development With D...
Python Django tutorial | Getting Started With Django | Web Development With D...Python Django tutorial | Getting Started With Django | Web Development With D...
Python Django tutorial | Getting Started With Django | Web Development With D...Edureka!
 
A winning combination: Plone as CMS and your favorite Python web framework as...
A winning combination: Plone as CMS and your favorite Python web framework as...A winning combination: Plone as CMS and your favorite Python web framework as...
A winning combination: Plone as CMS and your favorite Python web framework as...Carlos de la Guardia
 
Django Article V0
Django Article V0Django Article V0
Django Article V0Udi Bauman
 
Expanding XPages with Bootstrap Plugins for Ultimate Usability
Expanding XPages with Bootstrap Plugins for Ultimate UsabilityExpanding XPages with Bootstrap Plugins for Ultimate Usability
Expanding XPages with Bootstrap Plugins for Ultimate UsabilityTeamstudio
 
Ready, Set, Upgrade!
Ready, Set, Upgrade!Ready, Set, Upgrade!
Ready, Set, Upgrade!Cory Peters
 
UMD User's Group: DrupalCon 2011, Chicago
UMD User's Group: DrupalCon 2011, ChicagoUMD User's Group: DrupalCon 2011, Chicago
UMD User's Group: DrupalCon 2011, Chicagobrockfanning
 
بررسی چارچوب جنگو
بررسی چارچوب جنگوبررسی چارچوب جنگو
بررسی چارچوب جنگوrailsbootcamp
 
Company Visitor Management System Report.docx
Company Visitor Management System Report.docxCompany Visitor Management System Report.docx
Company Visitor Management System Report.docxfantabulous2024
 
Dreamwares Recent Projects
Dreamwares Recent ProjectsDreamwares Recent Projects
Dreamwares Recent ProjectsDreamwares
 
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013Mack Hardy
 
Lazy Coder Camp Edition 1
Lazy Coder Camp Edition 1Lazy Coder Camp Edition 1
Lazy Coder Camp Edition 1phpfactory
 
M365 global developer bootcamp 2019 PA
M365 global developer bootcamp 2019  PAM365 global developer bootcamp 2019  PA
M365 global developer bootcamp 2019 PAThomas Daly
 

Semelhante a Pinax Long Tutorial Slides (20)

Django
DjangoDjango
Django
 
M365 global developer bootcamp 2019 Intro to SPFx Version
M365 global developer bootcamp 2019 Intro to SPFx VersionM365 global developer bootcamp 2019 Intro to SPFx Version
M365 global developer bootcamp 2019 Intro to SPFx Version
 
Web Development in Django
Web Development in DjangoWeb Development in Django
Web Development in Django
 
Dev con pnp-engine-presentation
Dev con pnp-engine-presentationDev con pnp-engine-presentation
Dev con pnp-engine-presentation
 
Python Django tutorial | Getting Started With Django | Web Development With D...
Python Django tutorial | Getting Started With Django | Web Development With D...Python Django tutorial | Getting Started With Django | Web Development With D...
Python Django tutorial | Getting Started With Django | Web Development With D...
 
Django by rj
Django by rjDjango by rj
Django by rj
 
A winning combination: Plone as CMS and your favorite Python web framework as...
A winning combination: Plone as CMS and your favorite Python web framework as...A winning combination: Plone as CMS and your favorite Python web framework as...
A winning combination: Plone as CMS and your favorite Python web framework as...
 
Django Article V0
Django Article V0Django Article V0
Django Article V0
 
Expanding XPages with Bootstrap Plugins for Ultimate Usability
Expanding XPages with Bootstrap Plugins for Ultimate UsabilityExpanding XPages with Bootstrap Plugins for Ultimate Usability
Expanding XPages with Bootstrap Plugins for Ultimate Usability
 
Ready, Set, Upgrade!
Ready, Set, Upgrade!Ready, Set, Upgrade!
Ready, Set, Upgrade!
 
UMD User's Group: DrupalCon 2011, Chicago
UMD User's Group: DrupalCon 2011, ChicagoUMD User's Group: DrupalCon 2011, Chicago
UMD User's Group: DrupalCon 2011, Chicago
 
بررسی چارچوب جنگو
بررسی چارچوب جنگوبررسی چارچوب جنگو
بررسی چارچوب جنگو
 
Django
DjangoDjango
Django
 
Company Visitor Management System Report.docx
Company Visitor Management System Report.docxCompany Visitor Management System Report.docx
Company Visitor Management System Report.docx
 
Dreamwares Recent Projects
Dreamwares Recent ProjectsDreamwares Recent Projects
Dreamwares Recent Projects
 
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
 
Django Girls Tutorial
Django Girls TutorialDjango Girls Tutorial
Django Girls Tutorial
 
Lazy Coder Camp Edition 1
Lazy Coder Camp Edition 1Lazy Coder Camp Edition 1
Lazy Coder Camp Edition 1
 
django
djangodjango
django
 
M365 global developer bootcamp 2019 PA
M365 global developer bootcamp 2019  PAM365 global developer bootcamp 2019  PA
M365 global developer bootcamp 2019 PA
 

Mais de Daniel Greenfeld

Mais de Daniel Greenfeld (20)

How to Write a Popular Python Library by Accident
How to Write a Popular Python Library by AccidentHow to Write a Popular Python Library by Accident
How to Write a Popular Python Library by Accident
 
10 more-things-you-can-do-with-python
10 more-things-you-can-do-with-python10 more-things-you-can-do-with-python
10 more-things-you-can-do-with-python
 
From NASA to Startups to Big Commerce
From NASA to Startups to Big CommerceFrom NASA to Startups to Big Commerce
From NASA to Startups to Big Commerce
 
Thinking hard about_python
Thinking hard about_pythonThinking hard about_python
Thinking hard about_python
 
Intro to Data Visualizations
Intro to Data VisualizationsIntro to Data Visualizations
Intro to Data Visualizations
 
An Extreme Talk about the Zen of Python
An Extreme Talk about the Zen of PythonAn Extreme Talk about the Zen of Python
An Extreme Talk about the Zen of Python
 
PyCon Philippines 2012 Keynote
PyCon Philippines 2012 KeynotePyCon Philippines 2012 Keynote
PyCon Philippines 2012 Keynote
 
Round pegs and square holes
Round pegs and square holesRound pegs and square holes
Round pegs and square holes
 
Intro
IntroIntro
Intro
 
Intro to Python
Intro to PythonIntro to Python
Intro to Python
 
Lighting talk on django-social-auth
Lighting talk on django-social-authLighting talk on django-social-auth
Lighting talk on django-social-auth
 
Future of Collaboration
Future of CollaborationFuture of Collaboration
Future of Collaboration
 
Advanced Django Forms Usage
Advanced Django Forms UsageAdvanced Django Forms Usage
Advanced Django Forms Usage
 
The One Way
The One WayThe One Way
The One Way
 
Confessions of Joe Developer
Confessions of Joe DeveloperConfessions of Joe Developer
Confessions of Joe Developer
 
Python Worst Practices
Python Worst PracticesPython Worst Practices
Python Worst Practices
 
Django Worst Practices
Django Worst PracticesDjango Worst Practices
Django Worst Practices
 
How to sell django panel
How to sell django panelHow to sell django panel
How to sell django panel
 
Testing In Django
Testing In DjangoTesting In Django
Testing In Django
 
Django Uni-Form
Django Uni-FormDjango Uni-Form
Django Uni-Form
 

Último

A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 

Último (20)

A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 

Pinax Long Tutorial Slides

  • 1. Pinax Long Tutorial PyCon 2010
  • 3. Who are we? - James Tauber Pinax Founder CEO of Eldarion http://jtauber.com
  • 4. Who are we? - Daniel Greenfeld Pinax Core Developer Software Engineer for NASA's Science Mission Directorate Author/Instructor for Holden Web, LLC (holdenweb.com) Developer for Eldarion http://pydanny.com
  • 5.
  • 6. History of Pinax 2008: James Tauber decides to stop repeating himself 0.5 — First official release 2009: First full year of Pinax 0.7 — Groups, Static Media, Move to pip and virtualenv, Section 508 2010: Today 0.9 — Next great thing
  • 7. Philosophy of Pinax By integrating numerous reusable Django apps to take care of the things that many sites have in common, it lets you focus on what makes your site different. In other words... D on't R epeat Y ourself
  • 8. What will we be doing? Installing Pinax Reviewing the core underlying layer Changing the look and feel Various Pinax tricks Building on what Python and Django gives us Deployment Community
  • 10.
  • 11.
  • 12.
  • 14. Core: Accounts Avatar Email Addresses Language OpenID Password Management Signup Timezone
  • 15.
  • 16. Core: Groups Groups in Pinax are containers with user membership and content. They are a base on which to write your own app and plug in whatever content apps you need. Examples: Tribes (Wiki, Photos) Projects (Tasks, Wiki) Guilds (Events)
  • 17. Core: Static Media Handling css, images, javascript Project vs Pinax Theme vs App level Separation of static media from user-contributed media. build_static management command for deployment
  • 19.
  • 20. Using pinax-admin List all the currently available projects in Pinax pinax-admin clone_project -l Cloning a project pinax-admin clone_project social_project djangofans
  • 21.
  • 23. Some Pinax Settings SITE_NAME (used in some default templates) CONTACT_EMAIL (used in some default templates) PINAX_THEME (prefix for template resolution) ACCOUNT_OPEN_SIGNUP (can anyone join?) ACCOUNT_REQUIRED_EMAIL (is email address required?) ACCOUNT_EMAIL_VERIFICATION (must email be verified?) EMAIL_CONFIRMATION_DAYS (how long before expiry?) LOGIN_REDIRECT_URLNAME (first page to go after login)
  • 24. Media/Static Files Settings MEDIA_URL / MEDIA_ROOT    (URL and filesystem location for files uploaded/stored by Django only) STATIC_URL / STATIC_ROOT    (URL and filesystem location for site assets such as CSS, JS and images) SERVE_MEDIA      (Used in urls.py to hook-up MEDIA_URL and STATIC_URL used for development)
  • 25.
  • 26. Modification of core  Pinax applications ~10 minutes
  • 27. Profiles Frequently extended application You always want a custom field
  • 28. Modification of core Pinax applications Before you change a core application: Can you accomplish your tasks with CSS? Can you accomplish your tasks with Javascript? Can you accomplish your tasks with template changes? Can you create a new application that does the work?
  • 29. But my task needs a code/database change! pinax-env/lib/python2.x/site-packages/Pinax/pinax/apps/<app> pinax-env/src/Pinax/pinax/apps/<app> Don't make changes in Pinax itself!
  • 30. But my task needs a code/database change! Option 1: Use the apps directory of your project cd apps/ django-admin.py startapp profiles Option 2: Use virtualenv/pip Create a stand alone app (best done eggified) pip install -e my-app
  • 32. Won't conversion be hard? Remember: Pinax is just Django with an opinion pip install <django-app> (Don't forget to add it to your requirements.txt file) make changes to INSTALLED_APPS, etc in settings.py make template changes
  • 34. Customize templates, don't change them cp -r site-packages/pinax/templates/default/profiles my-project/templates Don't edit the Pinax templates directory!
  • 35. Themes in Pinax Change your look and feel by just changing settings.py!  PINAX_THEME = &quot;default&quot; But only one theme is currently shipped with Pinax PINAX_THEME = &quot;default&quot;
  • 36. Changing the logo Step 1: Add your image to <my-project>/media Step 2: In <my-project>/templates/site_base.html in the logo_link_image block change the name of the logo image to match your own. (but really you should be making more style changes than just the logo)
  • 37.
  • 38. Changing the look and feel ~10 minutes
  • 39.
  • 40.
  • 41. Adding CSS In templates/site_base.html {% block extra_head_base %}:      <link rel=&quot;stylesheet&quot; href=&quot;{{ MEDIA_URL }}custom.css&quot; /> mkdir site_media mkdir site_media/media touch custom.css body {      background-color: #000; }
  • 43. django-avatar by default uses Gravatar Pros: Gravatars follow a user's account name across the Internet Means users get a default avatar anywhere Cons: You might not want the default Gravatar avatar image You might not want to lock user avatars into a single service
  • 44. Changing the default Gravatar logo In settings.py AVATAR_DEFAULT_URL =  STATIC_URL + &quot;<our_custom_avatar.jpg>&quot; AVATAR_GRAVATAR_BACKUP = False
  • 46. What are groups? Groups in are containers with user  membership and content. Example: A project with tasks and wiki A guild with a forum and events
  • 47.
  • 48.
  • 49.
  • 50. Looking at django-groups pinax-admin clone_project sample_group_project sgp cd sgp python manage.py syncdb python manage.py runserver
  • 52.
  • 53.
  • 55. Tables are for tabular data
  • 56. In Section 508, some tabular forms are allowed
  • 57. Out of the box pretty Django forms are tabular
  • 58. Django Uni-Form = Django forms docs + template tag + Uni-Form css/js forms library
  • 60.  
  • 62. Making form generation easier {% load uni_form_tags %} {% with form.helper as helper %} {% uni_form form helper %} {% endwith %}
  • 63. Adding action handlers {% load uni_form_tags %} {% with form.helper as helper %} {% uni_form form helper %} {% endwith %}
  • 65.
  • 66. Static media is good Caching Security Separating servers
  • 67. build_static tool python manage.py help build_static Copy static media files from apps and other locations in a single location. --dry-run (don't copy but show what will be done) --link (create symlinks rather than copy) Project vs Pinax Theme vs App level
  • 68.
  • 69.
  • 70.
  • 71. JavaScript, jQuery and Pinax ~5 minutes
  • 72. Why was jQuery chosen for Pinax? Because Pinax has an opinion But you can still use YUI, Mootools, or plain old JavaScript
  • 73. Best practice for JavaScript use
  • 75. django-ajax-validation In urls.py:      from my_app.forms import MyAppForm      (r&quot;^validate/$&quot;, &quot;ajax_validation.views.validate&quot;, {          &quot;form_class&quot;: MyAppForm,          &quot;callback&quot;: lambda request, *args, **kwargs:                   {&quot;user&quot;: request.user}      }, &quot;myapp_form_validate&quot;),
  • 76.
  • 78.
  • 79. Testing your Pinax application ~5 minutes
  • 80. Why should you bother testing? &quot;Untested code is broken code&quot; Martin Aspelli &quot;Code without tests is broken as designed&quot; Jacob Kaplan-Moss &quot;All the cool kids are doing tests&quot; Chris Shenton &quot;If I go to another testing talk I'm going to die&quot; Daniel Greenfeld
  • 82.
  • 83.
  • 84.
  • 86.
  • 87.
  • 88.
  • 89.
  • 90. Q & A

Notas do Editor

  1. Mention:      LEGO      scaffolding
  2. Mention virtualenvwrapper by Doug Hellman.
  3. pip is an important part of Pinax for installing Python packages. We contribute back everything we do with it.
  4. At some point we probably want to review the account-relevant settings
  5. Point out that pinax groups are a base on which you write your own group app and plug in whatever content apps you need.
  6. There&apos;s more to static files than this. Mention the three levels of project, pinax theme and app Point out the analogies with template resolution Pluggable storage backend (http://pypi.python.org/pypi/django-staticfiles/#staticfiles-storage) allows to &amp;quot;build&amp;quot; static files to non filesystem storages, e.g. S3
  7. A proposal was accepted to fix how we handle project-level requirements. we will be working on it during PyCon
  8. MAILER_PAUSE_SEND is a boolean value that is checked whether or not the management command should even be ran (from the cron)
  9. JT: [REPEAT] I would say that groups are &amp;quot;containers with user membership and content&amp;quot; (i.e. can&apos;t skip the user membership aspect of it). JT: [REPEAT] we should point out that pinax groups are a base on which you write your own group app and plug in whatever content apps you need. JT: the key thing is that a content app that is group aware doesn&apos;t need to know about the specifics of the site developer&apos;s group app
  10. JT: we need to explain with examples of urls.py and models.py and views.py I think how this all works DG: I&apos;ll get a set of simple working examples out before presentation that people can thumb through. Or maybe add to sample_group_project.
  11. JL: maby other storage backends could be shown here, e.g. S3 or cloudfiles also see resolve_static management command
  12. Technically you can just say $(function() {...});
  13. BR: port number is set to 8001 for a common situation where Apache is proxied by a front-end webserver (recommended)