Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ba4c225

Browse files
initial commit
1 parent 4c29521 commit ba4c225

File tree

9 files changed

+303
-0
lines changed

9 files changed

+303
-0
lines changed

‎.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,5 @@ dmypy.json
127127

128128
# Pyre type checker
129129
.pyre/
130+
131+
.DS_Store

‎README.md

Whitespace-only changes.

‎config.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"""Construct Redis connection URI."""
2+
from os import environ
3+
4+
redis_host = environ.get('REDIS_HOST')
5+
redis_password = environ.get('REDIS_PASSWORD')
6+
redis_port = environ.get('REDIS_PORT')
7+
redis_uri = f'redis://:{redis_host}@{redis_password}:{redis_port}'
8+
9+
redis_expiration = 604800

‎poetry.lock

Lines changed: 233 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pyproject.toml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[tool.poetry]
2+
name = "redis-python-tutorial"
3+
version = "0.1.0"
4+
description = ""
5+
authors = ["Todd Birchard <toddbirchard@gmail.com>"]
6+
maintainers = ["Todd Birchard <toddbirchard@gmail.com>"]
7+
license = "MIT"
8+
readme = "README.md"
9+
homepage = ""
10+
repository = "https://github.com/hackersandslackers/redis-python-tutorial/"
11+
documentation = "https://hackersandslackers.com/using-redis-python-applications/"
12+
keywords = ["Redis",
13+
"Cache",
14+
"Queue",
15+
"Sessions",
16+
"NoSQL"]
17+
18+
[tool.poetry.dependencies]
19+
python = "^3.7"
20+
redis = "*"
21+
22+
[tool.poetry.dev-dependencies]
23+
pytest = "^4.6"
24+
25+
[build-system]
26+
requires = ["poetry>=0.12"]
27+
build-backend = "poetry.masonry.api"
28+
29+
[tool.poetry.scripts]
30+
init = "wsgi:main"
31+
32+
[tool.poetry.urls]
33+
issues = "https://github.com/hackersandslackers/python-poetry-tutorial/issues"

‎redis_python_tutorial/__init__.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"""Application entry point."""
2+
import redis
3+
from config import redis_uri, redis_expiration
4+
5+
r = redis.StrictRedis(url=redis_uri,
6+
charset="utf-8",
7+
decode_responses=True)
8+
9+
10+
def main():
11+
r.set('name', 'todd')
12+
r.set('ip_address', '0.0.0.0.')
13+
r.set('entry_page', 'dashboard')
14+
r.set('current_page', 'account')
15+
r.set('name', 'todd', redis_expiration)
16+
r.set('name', 'todd', redis_expiration)
17+
r.set('name', 'todd', redis_expiration)

‎tests/__init__.py

Whitespace-only changes.

‎tests/test_redis_python_tutorial.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from redis_python_tutorial import __version__
2+
3+
4+
def test_version():
5+
assert __version__ == '0.1.0'

‎wsgi.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from redis_python_tutorial import main
2+
3+
if __name__ == "__main__":
4+
main()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /