-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
336 lines (322 loc) · 28.1 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
# -*- coding: utf-8 -*-
# Estamos usando un sevidor HTTP que viene incluido en el framwork de Cherrypy
# Usamos como base de datos MONGODB. La base de datos se llama "cherrypies".
import random
import json
import string
import cherrypy
import os
from pymongo import MongoClient
from datetime import datetime
from pprint import pprint
from bson.objectid import ObjectId
from collections import namedtuple #esto permite traer los resultados de las queries como instancias de objetos.
import sys
reload(sys)
sys.setdefaultencoding('utf8')
import start_forever
class FrontEnd(object):
name = "Sacris.cl"
telephone = "22 938 1010"
address = "La Concepcion 81"
commune = "Providencia"
city = "Santiago"
country = "Chile"
js = """var parallax_map;
$().ready(function(){
responsive = $(window).width();
examples.initContactUsMap();
if (responsive >= 768){
parallax_map = $('.parallax').find('.big-map');
$(window).on('scroll',function(){
parallax();
gsdk.checkScrollForTransparentNavbar();
});
}
});
var parallax = function() {
var current_scroll = $(this).scrollTop();
oVal = ($(window).scrollTop() / 3);
parallax_map.css('top',oVal);
};"""
# Vistas basicas
@cherrypy.expose
def index(self):
header = open('frontend/views/header.html').read()
nav = open('frontend/views/nav.html').read()
body = open('frontend/index.html').read()
footer = open('frontend/views/footer.html').read()
return header.format(),nav.format(our=FrontEnd),body.format(our=FrontEnd),footer.format(our=FrontEnd)
# Paso 0: carga manual de datos de prueba en la base de datos
@cherrypy.expose
def create(self):
client = MongoClient()
db = client.cherrypies
result = db.users.insert_one(
{
"email": "[email protected]",
"telephone": "+56 22 200 2000",
"password": "",
"company": {
"name": "Tu Empresa",
"email": "[email protected]",
"telephone": "+56 22 200 2000",
"address": "Tu Direccion Comercial 100",
"webpage": {
"title_1": "Estudio Contable Profesional en Santiago de Chile",
"tag_line_1":"Estudio Contable Profesional",
"menu_1":"Inicio",
"menu_2":"Propuesta profesional",
"menu_3":"Servicios",
"menu_4":"Contacto",
"summary_title_1":"Nuestra Propuesta",
"summary_content_1":"El objetivo de su empresa es maximizar los retornos para sus accionistas. Trabajamos para ayudarle a conseguirlo.",
"proposition_title_1": "Servicios contables",
"proposition_title_2": "Planificación tributaria",
"proposition_title_3": "Auditoría de balances",
"proposition_title_4": "Servicios financieros",
"proposition_content_1": "Declaración mensual de impuestos",
"proposition_content_2": "Planificamos sus tributaciones para disminuir el pago de rentas",
"proposition_content_3": "Auditoria de sus Estados Financieros",
"proposition_content_4": "Asesoramiento en la presentación de proyectos frente a inversionistas",
"service_title_1":"Nuestros servicios",
"service_subtitle_1":"Distintos servicios standard",
"service_subtitle_2":"Opciones de servicios",
"pricing_title_1":"Estándard",
"pricing_title_2":"Contable, impositivo y legal",
"pricing_title_3":"Servicios Específicos",
"pricing_content_1":"Preparación y declaración de F29",
"pricing_content_2":"Aplicación normativas NIC e IFRS",
"pricing_content_3":"Planificación de rentas",
"pricing_content_4":"Revisión de contratos de trabajo",
"pricing_content_5":"Outsourcing contable",
"pricing_content_6":"Auditoría",
"customer_title_1":"Lo que nuestros clientes dicen de nosotros:",
"customer_subtitle_1":"Lo que nuestros clientes dicen de nosotros:",
"customer_content_1":"El servicio es recomendable, rápido e inteligente.",
"customer_content_2":"Son buenos profesionales. Su propuesta es transparente.",
"customer_content_3":"Generan ideas para planificar mejor tu tributación",
"customer_content_name_1":"Roberto Martinez de Oca",
"customer_content_name_2":"Javiera Cofré",
"customer_content_name_3":"Sabrina Melino",
"about_title_1": "Sobre Nosotros",
"about_content_1": "Estudio contable con años de experiencia asesorando tributariamente a nuestros clientes",
"contact_title_1":"Contáctanos",
"contact_subtitle_1":"Escribenos para agendar una reunión y comprender más nuestros servicio",
"action":"Ver más"
}
}
})
return "Objeto creado"
# Paso 1: crear un cliente desde la vista princial.
@cherrypy.expose
def user(self, email, telephone):
header = open('frontend/views/header.html').read()
body = open('frontend/company.html').read()
footer = open('frontend/views/footer.html').read()
client = MongoClient()
db = client.cherrypies
# Si el email ya existe, paso al usuario a la vista
if db.users.find({"email":email}).count() > 0:
cursor = db.users.find({"email":email})
User = namedtuple('user', 'email telephone, company') #uso namedtuple para llamar los resultados como objetos con notacion con puntos, como: "company.email"
Company = namedtuple('company', 'email name telephone address, webpage')
Webpage = namedtuple('webpage', 'title_1 tag_line_1 menu_1 menu_2 menu_3 menu_4 summary_title_1 summary_content_1 proposition_title_1 proposition_title_2 proposition_title_3 proposition_title_4 proposition_content_1 proposition_content_2 proposition_content_3 proposition_content_4 service_title_1 service_subtitle_1 service_subtitle_2 pricing_title_1 pricing_title_2 pricing_title_3 pricing_content_1 pricing_content_2 pricing_content_3 pricing_content_4 pricing_content_5 pricing_content_6 customer_title_1 customer_subtitle_1 customer_content_1 customer_content_2 customer_content_3 customer_content_name_1 customer_content_name_2 customer_content_name_3 about_title_1 about_content_1 contact_title_1 contact_subtitle_1 action')
for row in cursor:
user = User(row['email'],row['telephone'], Company(row['company']['email'],row['company']['name'],row['company']['telephone'],row['company']['address'],Webpage(row['company']['webpage']["title_1"],row['company']['webpage']["tag_line_1"],row['company']['webpage']["menu_1"],row['company']['webpage']["menu_2"],row['company']['webpage']["menu_3"],row['company']['webpage']["menu_4"],row['company']['webpage']["summary_title_1"],row['company']['webpage']["summary_content_1"],row['company']['webpage']["proposition_title_1"],row['company']['webpage']["proposition_title_2"],row['company']['webpage']["proposition_title_3"],row['company']['webpage']["proposition_title_4"],row['company']['webpage']["proposition_content_1"],row['company']['webpage']["proposition_content_2"],row['company']['webpage']["proposition_content_3"],row['company']['webpage']["proposition_content_4"],row['company']['webpage']["service_title_1"],row['company']['webpage']["service_subtitle_1"],row['company']['webpage']["service_subtitle_2"],row['company']['webpage']["pricing_title_1"],row['company']['webpage'] ["pricing_title_2"],row['company']['webpage']["pricing_title_3"],row['company']['webpage']["pricing_content_1"],row['company']['webpage']["pricing_content_2"],row['company']['webpage']["pricing_content_3"],row['company']['webpage']["pricing_content_4"],row['company']['webpage']["pricing_content_5"],row['company']['webpage']["pricing_content_6"],row['company']['webpage']["customer_title_1"],row['company']['webpage']["customer_subtitle_1"],row['company']['webpage']["customer_content_1"],row['company']['webpage']["customer_content_2"],row['company']['webpage']["customer_content_3"],row['company']['webpage']["customer_content_name_1"],row['company']['webpage']["customer_content_name_2"],row['company']['webpage']["customer_content_name_3"],row['company']['webpage']["about_title_1"],row['company']['webpage']["about_content_1"],row['company']['webpage']["contact_title_1"],row['company']['webpage']["contact_subtitle_1"],row['company']['webpage']["action"]))) #esta es la sintaxis necesaria para usar nametupe
design_route = "templates/a/index.html"
template = open(design_route).read()
return template.format(user=user, our=FrontEnd) # Si el email no existe, paso el email y el teléfono a la sesión para completar el registro en el próximo paso.
else:
cherrypy.session["email"] = email
cherrypy.session["telephone"] = telephone
return header.format(),body.format(our=FrontEnd),footer.format(our=FrontEnd)
# Paso 2:
#Opción A: crear un usuario y acceder desde la vista
@cherrypy.expose
def company(self, company_name, company_email, company_telephone):
email = cherrypy.session["email"]
telephone = cherrypy.session["telephone"]
client = MongoClient()
db = client.cherrypies
result = db.users.insert_one({
"email": email,
"telephone": telephone,
"password": "",
"company": {
"name": company_name,
"email": company_email,
"telephone": company_telephone,
"address": "Tu Direccion Comercial 100",
"webpage": {
"title_1": "Estudio Contable Profesional en Santiago de Chile",
"tag_line_1":"Estudio Contable Profesional",
"menu_1":"Inicio",
"menu_2":"Propuesta profesional",
"menu_3":"Servicios",
"menu_4":"Contacto",
"summary_title_1":"Nuestra Propuesta",
"summary_content_1":"El objetivo de su empresa es maximizar los retornos para sus accionistas. Trabajamos para ayudarle a conseguirlo.",
"proposition_title_1": "Servicios contables",
"proposition_title_2": "Planificación tributaria",
"proposition_title_3": "Auditoría de balances",
"proposition_title_4": "Servicios financieros",
"proposition_content_1": "Declaración mensual de impuestos",
"proposition_content_2": "Planificamos sus tributaciones para disminuir el pago de rentas",
"proposition_content_3": "Auditoria de sus Estados Financieros",
"proposition_content_4": "Asesoramiento en la presentación de proyectos frente a inversionistas",
"service_title_1":"Nuestros servicios",
"service_subtitle_1":"Distintos servicios standard",
"service_subtitle_2":"Opciones de servicios",
"pricing_title_1":"Estándard",
"pricing_title_2":"Contable, impositivo y legal",
"pricing_title_3":"Servicios Específicos",
"pricing_content_1":"Preparación y declaración de F29",
"pricing_content_2":"Aplicación normativas NIC e IFRS",
"pricing_content_3":"Planificación de rentas",
"pricing_content_4":"Revisión de contratos de trabajo",
"pricing_content_5":"Outsourcing contable",
"pricing_content_6":"Auditoría",
"customer_title_1":"Lo que nuestros clientes dicen de nosotros:",
"customer_subtitle_1":"Lo que nuestros clientes dicen de nosotros:",
"customer_content_1":"El servicio es recomendable, rápido e inteligente.",
"customer_content_2":"Son buenos profesionales. Su propuesta es transparente.",
"customer_content_3":"Generan ideas para planificar mejor tu tributación",
"customer_content_name_1":"Roberto Martinez de Oca",
"customer_content_name_2":"Javiera Cofré",
"customer_content_name_3":"Sabrina Melino",
"about_title_1": "Sobre Nosotros",
"about_content_1": "Estudio contable con años de experiencia asesorando tributariamente a nuestros clientes",
"contact_title_1":"Contáctanos",
"contact_subtitle_1":"Escribenos para agendar una reunión y comprender más nuestros servicio",
"action":"Ver más"
}
}
}) #primero se graban los datos y luego se trae y reorganiza con formato de objeto para pasar a la vista
cursor = db.users.find({"company.email":company_email})
User = namedtuple('user', 'email telephone, company') #uso namedtuple para llamar los resultados como objetos con notacion con puntos, como: "company.email"
Company = namedtuple('company', 'email name telephone address, webpage')
Webpage = namedtuple('webpage', 'title_1 tag_line_1 menu_1 menu_2 menu_3 menu_4 summary_title_1 summary_content_1 proposition_title_1 proposition_title_2 proposition_title_3 proposition_title_4 proposition_content_1 proposition_content_2 proposition_content_3 proposition_content_4 service_title_1 service_subtitle_1 service_subtitle_2 pricing_title_1 pricing_title_2 pricing_title_3 pricing_content_1 pricing_content_2 pricing_content_3 pricing_content_4 pricing_content_5 pricing_content_6 customer_title_1 customer_subtitle_1 customer_content_1 customer_content_2 customer_content_3 customer_content_name_1 customer_content_name_2 customer_content_name_3 about_title_1 about_content_1 contact_title_1 contact_subtitle_1 action')
for row in cursor:
user = User(row['email'],row['telephone'], Company(row['company']['email'],row['company']['name'],row['company']['telephone'],row['company']['address'],Webpage(row['company']['webpage']["title_1"],row['company']['webpage']["tag_line_1"],row['company']['webpage']["menu_1"],row['company']['webpage']["menu_2"],row['company']['webpage']["menu_3"],row['company']['webpage']["menu_4"],row['company']['webpage']["summary_title_1"],row['company']['webpage']["summary_content_1"],row['company']['webpage']["proposition_title_1"],row['company']['webpage']["proposition_title_2"],row['company']['webpage']["proposition_title_3"],row['company']['webpage']["proposition_title_4"],row['company']['webpage']["proposition_content_1"],row['company']['webpage']["proposition_content_2"],row['company']['webpage']["proposition_content_3"],row['company']['webpage']["proposition_content_4"],row['company']['webpage']["service_title_1"],row['company']['webpage']["service_subtitle_1"],row['company']['webpage']["service_subtitle_2"],row['company']['webpage']["pricing_title_1"],row['company']['webpage'] ["pricing_title_2"],row['company']['webpage']["pricing_title_3"],row['company']['webpage']["pricing_content_1"],row['company']['webpage']["pricing_content_2"],row['company']['webpage']["pricing_content_3"],row['company']['webpage']["pricing_content_4"],row['company']['webpage']["pricing_content_5"],row['company']['webpage']["pricing_content_6"],row['company']['webpage']["customer_title_1"],row['company']['webpage']["customer_subtitle_1"],row['company']['webpage']["customer_content_1"],row['company']['webpage']["customer_content_2"],row['company']['webpage']["customer_content_3"],row['company']['webpage']["customer_content_name_1"],row['company']['webpage']["customer_content_name_2"],row['company']['webpage']["customer_content_name_3"],row['company']['webpage']["about_title_1"],row['company']['webpage']["about_content_1"],row['company']['webpage']["contact_title_1"],row['company']['webpage']["contact_subtitle_1"],row['company']['webpage']["action"]))) #esta es la sintaxis necesaria para usar nametupe
design_route = "templates/a/index.html"
template = open(design_route).read()
return template.format(user=user, our=FrontEnd)
# Opcion Marketing B: Generar vista del template sin que el usuario este registrado
@cherrypy.expose
def unregistered(self, design = "a"):
client = MongoClient()
db = client.cherrypies
cursor = db.users.find({"company.email":"[email protected]"})
User = namedtuple('user', 'email telephone, company') #uso namedtuple para llamar los resultados como objetos con notacion con puntos, como: "company.email"
Company = namedtuple('company', 'email name telephone address, webpage')
Webpage = namedtuple('webpage', 'title_1 tag_line_1 menu_1 menu_2 menu_3 menu_4 summary_title_1 summary_content_1 proposition_title_1 proposition_title_2 proposition_title_3 proposition_title_4 proposition_content_1 proposition_content_2 proposition_content_3 proposition_content_4 service_title_1 service_subtitle_1 service_subtitle_2 pricing_title_1 pricing_title_2 pricing_title_3 pricing_content_1 pricing_content_2 pricing_content_3 pricing_content_4 pricing_content_5 pricing_content_6 customer_title_1 customer_subtitle_1 customer_content_1 customer_content_2 customer_content_3 customer_content_name_1 customer_content_name_2 customer_content_name_3 about_title_1 about_content_1 contact_title_1 contact_subtitle_1 action')
for row in cursor:
user = User(row['email'],row['telephone'], Company(row['company']['email'],row['company']['name'],row['company']['telephone'],row['company']['address'],Webpage(row['company']['webpage']["title_1"],row['company']['webpage']["tag_line_1"],row['company']['webpage']["menu_1"],row['company']['webpage']["menu_2"],row['company']['webpage']["menu_3"],row['company']['webpage']["menu_4"],row['company']['webpage']["summary_title_1"],row['company']['webpage']["summary_content_1"],row['company']['webpage']["proposition_title_1"],row['company']['webpage']["proposition_title_2"],row['company']['webpage']["proposition_title_3"],row['company']['webpage']["proposition_title_4"],row['company']['webpage']["proposition_content_1"],row['company']['webpage']["proposition_content_2"],row['company']['webpage']["proposition_content_3"],row['company']['webpage']["proposition_content_4"],row['company']['webpage']["service_title_1"],row['company']['webpage']["service_subtitle_1"],row['company']['webpage']["service_subtitle_2"],row['company']['webpage']["pricing_title_1"],row['company']['webpage'] ["pricing_title_2"],row['company']['webpage']["pricing_title_3"],row['company']['webpage']["pricing_content_1"],row['company']['webpage']["pricing_content_2"],row['company']['webpage']["pricing_content_3"],row['company']['webpage']["pricing_content_4"],row['company']['webpage']["pricing_content_5"],row['company']['webpage']["pricing_content_6"],row['company']['webpage']["customer_title_1"],row['company']['webpage']["customer_subtitle_1"],row['company']['webpage']["customer_content_1"],row['company']['webpage']["customer_content_2"],row['company']['webpage']["customer_content_3"],row['company']['webpage']["customer_content_name_1"],row['company']['webpage']["customer_content_name_2"],row['company']['webpage']["customer_content_name_3"],row['company']['webpage']["about_title_1"],row['company']['webpage']["about_content_1"],row['company']['webpage']["contact_title_1"],row['company']['webpage']["contact_subtitle_1"],row['company']['webpage']["action"]))) #esta es la sintaxis necesaria para usar nametupe
if design == "a":
design_route = "templates/a/index.html"
elif design == "b":
design_route = "templates/a/index_b.html"
else:
design_route = "templates/a/index_c.html"
template = open(design_route).read()
return template.format(user=user, our=FrontEnd)
# Opcion Marketing C: Generar vista del template sin que el usuario este registrado
@cherrypy.expose
def email(self, company_name, company_email, company_telephone, company_address):
client = MongoClient()
db = client.cherrypies
result = db.users.insert_one({
"email": "",
"telephone": "",
"password": "",
"company": {
"name": company_name,
"email": company_email,
"telephone": company_telephone,
"telephone": company_telephone,
"address": "Tu Direccion Comercial 100",
"webpage": {
"title_1": "Estudio Contable Profesional en Santiago de Chile",
"tag_line_1":"Estudio Contable Profesional",
"menu_1":"Inicio",
"menu_2":"Propuesta profesional",
"menu_3":"Servicios",
"menu_4":"Contacto",
"summary_title_1":"Nuestra Propuesta",
"summary_content_1":"El objetivo de su empresa es maximizar los retornos para sus accionistas. Trabajamos para ayudarle a conseguirlo.",
"proposition_title_1": "Servicios contables",
"proposition_title_2": "Planificación tributaria",
"proposition_title_3": "Auditoría de balances",
"proposition_title_4": "Servicios financieros",
"proposition_content_1": "Declaración mensual de impuestos",
"proposition_content_2": "Planificamos sus tributaciones para disminuir el pago de rentas",
"proposition_content_3": "Auditoria de sus Estados Financieros",
"proposition_content_4": "Asesoramiento en la presentación de proyectos frente a inversionistas",
"service_title_1":"Nuestros servicios",
"service_subtitle_1":"Distintos servicios standard",
"service_subtitle_2":"Opciones de servicios",
"pricing_title_1":"Estándard",
"pricing_title_2":"Contable, impositivo y legal",
"pricing_title_3":"Servicios Específicos",
"pricing_content_1":"Preparación y declaración de F29",
"pricing_content_2":"Aplicación normativas NIC e IFRS",
"pricing_content_3":"Planificación de rentas",
"pricing_content_4":"Revisión de contratos de trabajo",
"pricing_content_5":"Outsourcing contable",
"pricing_content_6":"Auditoría",
"customer_title_1":"Lo que nuestros clientes dicen de nosotros:",
"customer_subtitle_1":"Lo que nuestros clientes dicen de nosotros:",
"customer_content_1":"El servicio es recomendable, rápido e inteligente.",
"customer_content_2":"Son buenos profesionales. Su propuesta es transparente.",
"customer_content_3":"Generan ideas para planificar mejor tu tributación",
"customer_content_name_1":"Roberto Martinez de Oca",
"customer_content_name_2":"Javiera Cofré",
"customer_content_name_3":"Sabrina Melino",
"about_title_1": "Sobre Nosotros",
"about_content_1": "Estudio contable con años de experiencia asesorando tributariamente a nuestros clientes",
"contact_title_1":"Contáctanos",
"contact_subtitle_1":"Escribenos para agendar una reunión y comprender más nuestros servicio",
"action":"Ver más"
}
}
})
cursor = db.users.find({"company.email":company_email})
User = namedtuple('user', 'email telephone, company') #uso namedtuple para llamar los resultados como objetos con notacion con puntos, como: "company.email"
Company = namedtuple('company', 'email name telephone address, webpage')
Webpage = namedtuple('webpage', 'title_1 tag_line_1 menu_1 menu_2 menu_3 menu_4 summary_title_1 summary_content_1 proposition_title_1 proposition_title_2 proposition_title_3 proposition_title_4 proposition_content_1 proposition_content_2 proposition_content_3 proposition_content_4 service_title_1 service_subtitle_1 service_subtitle_2 pricing_title_1 pricing_title_2 pricing_title_3 pricing_content_1 pricing_content_2 pricing_content_3 pricing_content_4 pricing_content_5 pricing_content_6 customer_title_1 customer_subtitle_1 customer_content_1 customer_content_2 customer_content_3 customer_content_name_1 customer_content_name_2 customer_content_name_3 about_title_1 about_content_1 contact_title_1 contact_subtitle_1 action')
for row in cursor:
user = User(row['email'],row['telephone'], Company(row['company']['email'],row['company']['name'],row['company']['telephone'],row['company']['address'],Webpage(row['company']['webpage']["title_1"],row['company']['webpage']["tag_line_1"],row['company']['webpage']["menu_1"],row['company']['webpage']["menu_2"],row['company']['webpage']["menu_3"],row['company']['webpage']["menu_4"],row['company']['webpage']["summary_title_1"],row['company']['webpage']["summary_content_1"],row['company']['webpage']["proposition_title_1"],row['company']['webpage']["proposition_title_2"],row['company']['webpage']["proposition_title_3"],row['company']['webpage']["proposition_title_4"],row['company']['webpage']["proposition_content_1"],row['company']['webpage']["proposition_content_2"],row['company']['webpage']["proposition_content_3"],row['company']['webpage']["proposition_content_4"],row['company']['webpage']["service_title_1"],row['company']['webpage']["service_subtitle_1"],row['company']['webpage']["service_subtitle_2"],row['company']['webpage']["pricing_title_1"],row['company']['webpage'] ["pricing_title_2"],row['company']['webpage']["pricing_title_3"],row['company']['webpage']["pricing_content_1"],row['company']['webpage']["pricing_content_2"],row['company']['webpage']["pricing_content_3"],row['company']['webpage']["pricing_content_4"],row['company']['webpage']["pricing_content_5"],row['company']['webpage']["pricing_content_6"],row['company']['webpage']["customer_title_1"],row['company']['webpage']["customer_subtitle_1"],row['company']['webpage']["customer_content_1"],row['company']['webpage']["customer_content_2"],row['company']['webpage']["customer_content_3"],row['company']['webpage']["customer_content_name_1"],row['company']['webpage']["customer_content_name_2"],row['company']['webpage']["customer_content_name_3"],row['company']['webpage']["about_title_1"],row['company']['webpage']["about_content_1"],row['company']['webpage']["contact_title_1"],row['company']['webpage']["contact_subtitle_1"],row['company']['webpage']["action"]))) #esta es la sintaxis necesaria para usar nametupe
design_route = "templates/a/index.html"
template = open(design_route).read()
return template.format(user=user, our=FrontEnd)
# Se pueden ver los resultados ingresando http://localhost:9090/template?design=a&[email protected]
if __name__ == '__main__':
# Rutas y configuraciones adicionales
conf = {
'/': {
'tools.sessions.on': True,
'tools.staticdir.root': os.path.abspath(os.getcwd()),
},
'/user': {
'tools.sessions.on': True,
},
'/company': {
'tools.sessions.on': True,
},
'/static': {
'tools.staticdir.on': True,
'tools.staticdir.dir': './frontend/public'
},
'/root': {
'tools.staticdir.on': True,
'tools.staticdir.dir': './templates/a/'
},
'/favicon.ico':
{
'tools.staticfile.on': True,
'tools.staticfile.filename': './frontend/public/favicon.ico'
}
}
cherrypy.config.update("server")
cherrypy.quickstart(FrontEnd(), "/", conf)