Skip to content

Commit ba4c225

Browse files
committed
initial commit
1 parent 4c29521 commit ba4c225

File tree

9 files changed

+303
-0
lines changed

9 files changed

+303
-0
lines changed

Diff for: .gitignore

+2
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

Diff for: README.md

Whitespace-only changes.

Diff for: config.py

+9
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

Diff for: poetry.lock

+233
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: pyproject.toml

+33
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"

Diff for: redis_python_tutorial/__init__.py

+17
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)

Diff for: tests/__init__.py

Whitespace-only changes.

Diff for: tests/test_redis_python_tutorial.py

+5
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'

Diff for: wsgi.py

+4
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)