SlideShare a Scribd company logo
THE USE OF AT J AIME  B UELTA [email_address]
Presentaci'on de Jolt Online
Overview de retail campaign
 
ATYPICAL
csv_file = StringIO()
output_file = csv.writer(csv_file,
dialect=csv.excel)
output_file.writerow([ 'Time UTC' ,
datetime.datetime.utcnow()])
output_file.writerow([ 'Column1' , 'Column2' ])  output_file.writerows(
(value,  '{0}%' .format(value/total *  100 ))
for  value  in  data)
return  HttpResponse(csv_file.getvalue(), 'text/csv' )
from  drawing_char  import  LineChart
# Instance Do fancy stuff
d = LineChart(WIDTH, HEIGTH)
# Data is just a list of values
d.char.data = ( 1.2 ,  2.3 ,  4.5 )
# X axis labels
d.chart.categoryAxis.categoryNames=( 't1' , 't2' ,  't3' )
binary = d.asString( 'png' )
return  HttpResponse(binary, 'image/png' )
C/C++
DATABASE WORK
FIXTURES
# Setup environment for Django ORM from  django.conf  import  settings import  os from  codecs  import  ignore_errors if   'DJANGO_SETTINGS_MODULE'   not in  os.environ: os.environ[ 'DJANGO_SETTINGS_MODULE '] =  'settings'

More Related Content

PDF
Basicsof c make and git for a hello qt application
PDF
Manageable data pipelines with airflow (and kubernetes) november 27, 11 45 ...
PDF
BeautifulSoup / selenium Deep dive
PDF
Real World Optimization
PDF
Regular expressions, Alex Perry, Google, PyCon2014
DOCX
Bubble in link list
PDF
Illustrator_Sample
DOCX
Basicsof c make and git for a hello qt application
Manageable data pipelines with airflow (and kubernetes) november 27, 11 45 ...
BeautifulSoup / selenium Deep dive
Real World Optimization
Regular expressions, Alex Perry, Google, PyCon2014
Bubble in link list
Illustrator_Sample

What's hot (20)

PDF
MongoDB World 2019: Event Horizon: Meet Albert Einstein As You Move To The Cloud
PDF
Quick 入門 | iOS RDD テストフレームワーク for Swift/Objective-C
PDF
A, B, C. 1, 2, 3. Iterables you and me - Willian Martins (ebay)
PPT
Open Cv Tutorial Ii
PPTX
我在 Mac 上的常用开发工具
DOCX
Logistic Regression in R-An Exmple.
PDF
An Introduction to JavaScript: Week 5
PPTX
Data Types and Processing in ES6
PDF
Machine Learning In Ruby
PPT
Hight Work
DOCX
Implementation of k-means clustering algorithm in C
PDF
Presentation template - jupyter2slides
PDF
Hexagonal architecture & Elixir
PDF
Flink meetup
PDF
Altitude San Francisco 2018: WebAssembly Tools & Applications
PDF
Scaling FastAGI Applications with Go
DOCX
Write a program that calculate the no of prime no,even and odd no.
PPT
Python And GIS - Beyond Modelbuilder And Pythonwin
DOCX
Array using recursion
PDF
Performance testing of microservices in Action
MongoDB World 2019: Event Horizon: Meet Albert Einstein As You Move To The Cloud
Quick 入門 | iOS RDD テストフレームワーク for Swift/Objective-C
A, B, C. 1, 2, 3. Iterables you and me - Willian Martins (ebay)
Open Cv Tutorial Ii
我在 Mac 上的常用开发工具
Logistic Regression in R-An Exmple.
An Introduction to JavaScript: Week 5
Data Types and Processing in ES6
Machine Learning In Ruby
Hight Work
Implementation of k-means clustering algorithm in C
Presentation template - jupyter2slides
Hexagonal architecture & Elixir
Flink meetup
Altitude San Francisco 2018: WebAssembly Tools & Applications
Scaling FastAGI Applications with Go
Write a program that calculate the no of prime no,even and odd no.
Python And GIS - Beyond Modelbuilder And Pythonwin
Array using recursion
Performance testing of microservices in Action
Ad

Similar to Use of django at jolt online v3 (20)

PPT
Scripting GeoServer with GeoScript
PPT
Groovy Introduction - JAX Germany - 2008
PPT
What's New in ZF 1.10
PPTX
Groovy
PPT
Introduction To Groovy 2005
PPTX
Managing console
PDF
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)
PDF
Refactoring to Macros with Clojure
PPT
Cpp tutorial
PDF
Phil Bartie QGIS PLPython
PDF
Kirk Shoop, Reactive programming in C++
PDF
.gradle 파일 정독해보기
PPT
Plone For Developers - World Plone Day, 2009
DOCX
filesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docx
ODP
perl usage at database applications
PDF
Visual Exploration of Large Data sets with D3, crossfilter and dc.js
PPT
Introduction to Assembly Language
PDF
Time Series Analysis Sample Code
PDF
Writing DSLs with Parslet - Wicked Good Ruby Conf
PPTX
XML-Free Programming
Scripting GeoServer with GeoScript
Groovy Introduction - JAX Germany - 2008
What's New in ZF 1.10
Groovy
Introduction To Groovy 2005
Managing console
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)
Refactoring to Macros with Clojure
Cpp tutorial
Phil Bartie QGIS PLPython
Kirk Shoop, Reactive programming in C++
.gradle 파일 정독해보기
Plone For Developers - World Plone Day, 2009
filesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docx
perl usage at database applications
Visual Exploration of Large Data sets with D3, crossfilter and dc.js
Introduction to Assembly Language
Time Series Analysis Sample Code
Writing DSLs with Parslet - Wicked Good Ruby Conf
XML-Free Programming
Ad

More from Jaime Buelta (6)

PDF
A Django project template for a RESTful application using Docker
PDF
Make beautiful Python code
KEY
Use git the proper way
KEY
Do more than one thing at the same time, the Python way
PDF
Utopia Kindgoms scaling case: From 4 to 50K users
PDF
Database madness with_mongoengine_and_sql_alchemy
A Django project template for a RESTful application using Docker
Make beautiful Python code
Use git the proper way
Do more than one thing at the same time, the Python way
Utopia Kindgoms scaling case: From 4 to 50K users
Database madness with_mongoengine_and_sql_alchemy

Recently uploaded (20)

PDF
Encapsulation theory and applications.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Approach and Philosophy of On baking technology
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
Encapsulation theory and applications.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Dropbox Q2 2025 Financial Results & Investor Presentation
Building Integrated photovoltaic BIPV_UPV.pdf
Machine learning based COVID-19 study performance prediction
Unlocking AI with Model Context Protocol (MCP)
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
sap open course for s4hana steps from ECC to s4
Approach and Philosophy of On baking technology
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Digital-Transformation-Roadmap-for-Companies.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Mobile App Security Testing_ A Comprehensive Guide.pdf
Spectral efficient network and resource selection model in 5G networks
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Chapter 3 Spatial Domain Image Processing.pdf

Use of django at jolt online v3

Editor's Notes

  • #2: This presentation will explain some techniques and highlights on the use of Django (and related stuff) on our day-to-day operations on Jolt Online.
  • #3: Jolt is making browser games like Legends of Zork, Utopia Kingdoms or Playboy Manager. Our actual main programming languages are Python and Ruby. We make extensive use of Django and Ruby on Rails.
  • #4: Currently there is a campaign ongoing in the US for stores. There distributing promotional codes that will give advantages for the users registering them. Each code is unique, and it's related to the store. To keep track of the distribution of codes, and to encourage the stores to distribute them, we have develop a system to show the actual performance of the stores and make some rankings. The presentation explains some techniques using in this project. The project is made in Django, of course.
  • #5: Basic configuration of the production environment.
  • #6: Some ways of using Django that are not the usual ones.
  • #7: Django not always has to server templates or text files. It can generate CSV files using the Python standard library. StringIO is a ”fake file”. You can use it like a file and then get the information with .get_value()
  • #8: Django can also return binary data, in this case, a chart generated by reportlabs
  • #9: Using XML-RPC, you can allow remote function calls to Python code. The functions are accessible to any language with a XML-RPC library. On Jolt we use it to access the application mostly from Ruby code (Legends of Zork is made with Ruby on Rails).
  • #10: Some useful techniques to work with the database using Django tools. Photo: http://everystockphoto.com/photo.php?imageId=1310754
  • #11: You can define a fixture with the defined data to include on the database. Management command loaddata will load fixtures in the app/fixtures directory (no need for complete path) The data can also be dumped from the database: python manage.py dumpdata --format=json myapp > /path/to/myapp/fixtures/initial_data.json If the fixture is called initial_data.sjon, it will be loaed after create the database with syncdb. Initial data can be created with Django shell command and then dumped. Very useful in development!
  • #12: That will allow to run the script using Django settings Also django-extensions allows the use of jobs and scheduled jobs.
  • #13: You can use those stand-alone scripts to perform operations on the database not directly linked to the web application, like calculate periodically statistics or other data.
  • #16: The Django ORM is really good, but it's slow for some big scale operations.
  • #17: Example. Retail campaign. Generate millions promotional codes and insert on the database. Generation was really fast (just 9 random characters) Generation and insertion into database using Django ORM takes about 3 hours As we generate using a web interface, that will lead to create some actualization, progress bar, syncronization, etc to show the user the progress. That is not trivial to achieve.
  • #18: Solution: Generate an SQL insert script (text file) Time to insert the codes < 3 minutes (1.5 writing file and 1.5 inserting into database) The user can wait that amount of time just with a ”This operation can take a few minutes” message. That simplifies the application. From time to time the best options it to keep using SQL
  • #19: Other tools used on the deployment and use of the applications on production.
  • #20: The staging server has the same environment, but is not serving to the public. Virtual Environment allow to create a controlled environment, without having to depend on the machine for the python setup. Fabric help in the deployment in an automated way git gets the proper version of the code to be deployed
  • #21: Isolated environment Generate script with all the Python packages you need for your application installed through easy_install Django 1.1 or other specific version Django-debug-toolbar Django-extensions … Use source virtualenv/bin/activate to change shell or user virtualenv/bin/python interpreter
  • #22: Executes remote commands using ssh Simplify a lot of maintenance operations and repetitive work. Avoids errors. The code should behave differently on a production deployment than on a development deployment (e.g, using a file only on production)
  • #23: Example of the output of the execution of fabric command (simplified) We use also Capistrano (similar concept in Ruby)
  • #24: It's great even for using it on a personal project, as it encourages frequents commits and branching, something that in other SCMs is difficult. The use of git is difficult and takes time to undestand its philosophy, but it's worth it
  • #25: Git helps in making a lot of commits, each one with a particular step. You can search the commits and get back to any point The merging is easy (merging in SVN is risky). It is also much easier to generate new (small) branches with features and merge them into master (or trunk). Avoids the ”don't send your changes yet!” scenario. It's much complex, SVN is easier to use. Most of the difficulties (and advantages) comes from being distributed (e.g. There is no such thing as a central repository)
  • #26: The current schema on Jolt to production follows roughly the one on http://nvie.com/git-model
  • #27: This presentation will be available on my personal blog, www.wrongsideofmemphis.wordpress.com
  • #28: Thanks for the attention! Photos from MorgueFile