40 lines
782 B
Plaintext
40 lines
782 B
Plaintext
|
Development Setup:
|
||
|
$ sudo apt install python3 python3-pip python-virtualenv python3-virtualenv
|
||
|
$ virtualenv -p python3 env
|
||
|
$ . env/bin/activate
|
||
|
$ pip install -r requirements.txt
|
||
|
|
||
|
Django clone setup:
|
||
|
$ python manage.py makemigrations
|
||
|
$ python manage.py migrate
|
||
|
$ python manage.py createsuperuser
|
||
|
$ DEBUG=true python manage.py runserver 0.0.0.0:8000
|
||
|
|
||
|
|
||
|
Logging:
|
||
|
|
||
|
use logger.exception
|
||
|
|
||
|
Machine learning:
|
||
|
comma.ai switched to pyTorch
|
||
|
|
||
|
|
||
|
How to make a package:
|
||
|
https://news.t0.vc/ZBPS
|
||
|
|
||
|
|
||
|
Timezones
|
||
|
=========
|
||
|
|
||
|
NEVER USE .replace(tzinfo= EXCEPT FOR WITH UTC!
|
||
|
|
||
|
Assigning timezone to parsed string:
|
||
|
- example, you get a text timestamp and parse it with strptime
|
||
|
- solution:
|
||
|
t = datetime.strptime(timestamp, '%Y-%m-%d %H:%M:%S')
|
||
|
tz = pytz.timezone('America/Edmonton')
|
||
|
result = tz.localize(t)
|
||
|
|
||
|
|
||
|
|