| (* | |
| Evernote Morning Page | |
| VERSION 1.0 | |
| September 10, 2019 | |
| USAGE: | |
| Save with Script Editor | |
| then open a terminal | |
| run `crontab -e` | |
| add entry `# * 6 * * * osascript ~/Downloads/evernote-morning-page.scpt` |
| [Unit] | |
| Description=Gunicorn PROJECTNAME Daemon | |
| After=network.target | |
| [Service] | |
| User=VALIDUSER | |
| Group=www-data | |
| WorkingDirectory=/PATH/TO/PROJECT/ROOT | |
| ExecStart=/PATH/TO/GUNICORN/bin/gunicorn --workers 3 --bind unix:/PATH/TO/PROJECT/ROOT/PROJECTNAME.sock PROJECTDIR.wsgi:application | |
| [Install] |
| fundweb_1 | fail: Microsoft.EntityFrameworkCore.Update[10000] | |
| fundweb_1 | An exception occurred in the database while saving changes for context type 'FundWeb.Data.FundWebContext'. | |
| fundweb_1 | System.InvalidOperationException: A second operation started on this context before a previous operation completed. Any instance members are not guaranteed to be thread safe. | |
| fundweb_1 | at Microsoft.EntityFrameworkCore.Internal.ConcurrencyDetector.EnterCriticalSection() | |
| fundweb_1 | at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.<SaveChangesAsync>d__61.MoveNext() | |
| fundweb_1 | --- End of stack trace from previous location where exception was thrown --- | |
| fundweb_1 | at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() | |
| fundweb_1 | at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) | |
| fundweb_1 | at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() | |
| fundweb_1 | |
| # function being called | |
| # Use case is within a migration | |
| # apps = `from django.apps import apps` -- within a migration | |
| # model_name = str lowercase model name | |
| def blob_to_file(apps, model_name, text_field_name, file_field_name): | |
| """ | |
| Upload existing TextField json blobs to files. | |
| """ |
If you are unable or uncomfortable with installing programs to your computer you can use the following web-site. It will be fully functional for this bootcamp but will not provide some useful shortcuts.
Python is already installed -- =)
Install easy_install
| import unittest | |
| class TestStringMethods(unittest.TestCase): | |
| def test_upper(self): | |
| self.assertEqual('foo'.upper(), 'FOO') | |
| def test_isupper(self): | |
| self.assertTrue('FOO'.isupper()) | |
| self.assertFalse('Foo'.isupper()) |
This section will continue from our Davinci Django project.
First we'll update our existing models to include additional fields.
Open hello_world/models.py and add 2 fields to StuffToRate
ex:
color = models.CharField(max_length=100, default='Green')
description = models.TextField()
| # https://www.codewars.com/kata/convert-string-to-camel-case/train/python | |
| def to_camel_case(text): | |
| text_list = text.replace('-', '_').split('_') | |
| answer_list = [text_list[0], ] | |
| for word in text_list[1:]: | |
| answer_list.append( word.title() ) | |
| return ''.join(answer_list) | |