Skip to content

Commit f3fdbfa

Browse files
authored
Added app1 implementation
1 parent 914bb29 commit f3fdbfa

15 files changed

Lines changed: 475 additions & 0 deletions

‎pyramid/app1/CHANGES.txt‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
0.0
2+
---
3+
4+
- Initial version.

‎pyramid/app1/MANIFEST.in‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
include *.txt *.ini *.cfg *.rst
2+
recursive-include app1 *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.js *.html *.xml *.jinja2

‎pyramid/app1/README.txt‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
app1
2+
====
3+
4+
Getting Started
5+
---------------
6+
7+
- Change directory into your newly created project.
8+
9+
cd app1
10+
11+
- Create a Python virtual environment.
12+
13+
python3 -m venv env
14+
15+
- Upgrade packaging tools.
16+
17+
env/bin/pip install --upgrade pip setuptools
18+
19+
- Install the project in editable mode with its testing requirements.
20+
21+
env/bin/pip install -e ".[testing]"
22+
23+
- Run your project's tests.
24+
25+
env/bin/pytest
26+
27+
- Run your project.
28+
29+
env/bin/pserve development.ini

‎pyramid/app1/app1/__init__.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from pyramid.config import Configurator
2+
3+
4+
def main(global_config, **settings):
5+
""" This function returns a Pyramid WSGI application.
6+
"""
7+
config = Configurator(settings=settings)
8+
config.include('pyramid_jinja2')
9+
config.add_static_view('static', 'static', cache_max_age=3600)
10+
config.add_route('home', '/')
11+
config.scan()
12+
return config.make_wsgi_app()
1.29 KB
Loading
12.6 KB
Loading

‎pyramid/app1/app1/static/theme.css‎

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
@import url(//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700);
2+
body {
3+
font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
4+
font-weight: 300;
5+
color: #ffffff;
6+
background: #bc2131;
7+
}
8+
h1,
9+
h2,
10+
h3,
11+
h4,
12+
h5,
13+
h6 {
14+
font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
15+
font-weight: 300;
16+
}
17+
p {
18+
font-weight: 300;
19+
}
20+
.font-normal {
21+
font-weight: 400;
22+
}
23+
.font-semi-bold {
24+
font-weight: 600;
25+
}
26+
.font-bold {
27+
font-weight: 700;
28+
}
29+
.starter-template {
30+
margin-top: 250px;
31+
}
32+
.starter-template .content {
33+
margin-left: 10px;
34+
}
35+
.starter-template .content h1 {
36+
margin-top: 10px;
37+
font-size: 60px;
38+
}
39+
.starter-template .content h1 .smaller {
40+
font-size: 40px;
41+
color: #f2b7bd;
42+
}
43+
.starter-template .content .lead {
44+
font-size: 25px;
45+
color: #f2b7bd;
46+
}
47+
.starter-template .content .lead .font-normal {
48+
color: #ffffff;
49+
}
50+
.starter-template .links {
51+
float: right;
52+
right: 0;
53+
margin-top: 125px;
54+
}
55+
.starter-template .links ul {
56+
display: block;
57+
padding: 0;
58+
margin: 0;
59+
}
60+
.starter-template .links ul li {
61+
list-style: none;
62+
display: inline;
63+
margin: 0 10px;
64+
}
65+
.starter-template .links ul li:first-child {
66+
margin-left: 0;
67+
}
68+
.starter-template .links ul li:last-child {
69+
margin-right: 0;
70+
}
71+
.starter-template .links ul li.current-version {
72+
color: #f2b7bd;
73+
font-weight: 400;
74+
}
75+
.starter-template .links ul li a, a {
76+
color: #f2b7bd;
77+
text-decoration: underline;
78+
}
79+
.starter-template .links ul li a:hover, a:hover {
80+
color: #ffffff;
81+
text-decoration: underline;
82+
}
83+
.starter-template .links ul li .icon-muted {
84+
color: #eb8b95;
85+
margin-right: 5px;
86+
}
87+
.starter-template .links ul li:hover .icon-muted {
88+
color: #ffffff;
89+
}
90+
.starter-template .copyright {
91+
margin-top: 10px;
92+
font-size: 0.9em;
93+
color: #f2b7bd;
94+
text-transform: lowercase;
95+
float: right;
96+
right: 0;
97+
}
98+
@media (max-width: 1199px) {
99+
.starter-template .content h1 {
100+
font-size: 45px;
101+
}
102+
.starter-template .content h1 .smaller {
103+
font-size: 30px;
104+
}
105+
.starter-template .content .lead {
106+
font-size: 20px;
107+
}
108+
}
109+
@media (max-width: 991px) {
110+
.starter-template {
111+
margin-top: 0;
112+
}
113+
.starter-template .logo {
114+
margin: 40px auto;
115+
}
116+
.starter-template .content {
117+
margin-left: 0;
118+
text-align: center;
119+
}
120+
.starter-template .content h1 {
121+
margin-bottom: 20px;
122+
}
123+
.starter-template .links {
124+
float: none;
125+
text-align: center;
126+
margin-top: 60px;
127+
}
128+
.starter-template .copyright {
129+
float: none;
130+
text-align: center;
131+
}
132+
}
133+
@media (max-width: 767px) {
134+
.starter-template .content h1 .smaller {
135+
font-size: 25px;
136+
display: block;
137+
}
138+
.starter-template .content .lead {
139+
font-size: 16px;
140+
}
141+
.starter-template .links {
142+
margin-top: 40px;
143+
}
144+
.starter-template .links ul li {
145+
display: block;
146+
margin: 0;
147+
}
148+
.starter-template .links ul li .icon-muted {
149+
display: none;
150+
}
151+
.starter-template .copyright {
152+
margin-top: 20px;
153+
}
154+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<!DOCTYPE html>
2+
<html lang="{{request.locale_name}}">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<meta name="description" content="pyramid web application">
8+
<meta name="author" content="Pylons Project">
9+
<link rel="shortcut icon" href="{{request.static_url('app1:static/pyramid-16x16.png')}}">
10+
11+
<title>Cookiecutter Starter project for the Pyramid Web Framework</title>
12+
13+
<!-- Bootstrap core CSS -->
14+
<link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
15+
16+
<!-- Custom styles for this scaffold -->
17+
<link href="{{request.static_url('app1:static/theme.css')}}" rel="stylesheet">
18+
19+
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
20+
<!--[if lt IE 9]>
21+
<script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js" integrity="sha384-0s5Pv64cNZJieYFkXYOTId2HMA2Lfb6q2nAcx2n0RTLUnCAoTTsS0nKEO27XyKcY" crossorigin="anonymous"></script>
22+
<script src="//oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js" integrity="sha384-f1r2UzjsxZ9T4V1f2zBO/evUqSEOpeaUUZcMTz1Up63bl4ruYnFYeM+BxI4NhyI0" crossorigin="anonymous"></script>
23+
<![endif]-->
24+
</head>
25+
26+
<body>
27+
28+
<div class="starter-template">
29+
<div class="container">
30+
<div class="row">
31+
<div class="col-md-2">
32+
<img class="logo img-responsive" src="{{request.static_url('app1:static/pyramid.png') }}" alt="pyramid web framework">
33+
</div>
34+
<div class="col-md-10">
35+
{% block content %}
36+
<p>No content</p>
37+
{% endblock content %}
38+
</div>
39+
</div>
40+
<div class="row">
41+
<div class="links">
42+
<ul>
43+
<li><i class="glyphicon glyphicon-cog icon-muted"></i><a href="https://github.com/Pylons/pyramid">Github Project</a></li>
44+
<li><i class="glyphicon glyphicon-globe icon-muted"></i><a href="https://webchat.freenode.net/?channels=pyramid">IRC Channel</a></li>
45+
<li><i class="glyphicon glyphicon-home icon-muted"></i><a href="https://pylonsproject.org">Pylons Project</a></li>
46+
</ul>
47+
</div>
48+
</div>
49+
<div class="row">
50+
<div class="copyright">
51+
Copyright &copy; Pylons Project
52+
</div>
53+
</div>
54+
</div>
55+
</div>
56+
57+
58+
<!-- Bootstrap core JavaScript
59+
================================================== -->
60+
<!-- Placed at the end of the document so the pages load faster -->
61+
<script src="//oss.maxcdn.com/libs/jquery/1.10.2/jquery.min.js" integrity="sha384-aBL3Lzi6c9LNDGvpHkZrrm3ZVsIwohDD7CDozL0pk8FwCrfmV7H9w8j3L7ikEv6h" crossorigin="anonymous"></script>
62+
<script src="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js" integrity="sha384-s1ITto93iSMDxlp/79qhWHi+LsIi9Gx6yL+cOKDuymvihkfol83TYbLbOw+W/wv4" crossorigin="anonymous"></script>
63+
</body>
64+
</html>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{% extends "layout.jinja2" %}
2+
3+
{% block content %}
4+
<div class="content">
5+
<h1><span class="font-semi-bold">Pyramid</span> <span class="smaller">Starter project</span></h1>
6+
<p class="lead">Welcome to <span class="font-normal">app1</span>, a&nbsp;Pyramid application generated&nbsp;by<br><span class="font-normal">Cookiecutter</span>.</p>
7+
</div>
8+
{% endblock content %}

‎pyramid/app1/app1/tests.py‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import unittest
2+
3+
from pyramid import testing
4+
5+
6+
class ViewTests(unittest.TestCase):
7+
def setUp(self):
8+
self.config = testing.setUp()
9+
10+
def tearDown(self):
11+
testing.tearDown()
12+
13+
def test_my_view(self):
14+
from .views import my_view
15+
request = testing.DummyRequest()
16+
info = my_view(request)
17+
self.assertEqual(info['project'], 'app1')
18+
19+
20+
class FunctionalTests(unittest.TestCase):
21+
def setUp(self):
22+
from app1 import main
23+
app = main({})
24+
from webtest import TestApp
25+
self.testapp = TestApp(app)
26+
27+
def test_root(self):
28+
res = self.testapp.get('/', status=200)
29+
self.assertTrue(b'Pyramid' in res.body)

0 commit comments

Comments
 (0)