From eb957d50baa509e2c0c123379ad7990f47f3ba20 Mon Sep 17 00:00:00 2001 From: <> Date: Fri, 6 Sep 2024 03:07:59 +0000 Subject: [PATCH] Deployed 4de3381 with MkDocs version: 1.6.1 --- .nojekyll | 0 404.html | 2956 ++++++++ 4geeks-libraries/index.html | 2999 ++++++++ advanced/celery/application/index.html | 3077 ++++++++ advanced/celery/canvas/index.html | 3057 ++++++++ advanced/celery/periodic-tasks/index.html | 3057 ++++++++ advanced/celery/routing/index.html | 3057 ++++++++ advanced/celery/settings/index.html | 2999 ++++++++ apps/activities/index.html | 3127 ++++++++ apps/admissions/index.html | 3023 ++++++++ apps/monitoring/introduction/index.html | 3070 ++++++++ apps/monitoring/scripts/index.html | 3216 ++++++++ assets/_mkdocstrings.css | 119 + assets/images/favicon.png | Bin 0 -> 1870 bytes assets/javascripts/bundle.56dfad97.min.js | 16 + assets/javascripts/bundle.56dfad97.min.js.map | 7 + assets/javascripts/lunr/min/lunr.ar.min.js | 1 + assets/javascripts/lunr/min/lunr.da.min.js | 18 + assets/javascripts/lunr/min/lunr.de.min.js | 18 + assets/javascripts/lunr/min/lunr.du.min.js | 18 + assets/javascripts/lunr/min/lunr.el.min.js | 1 + assets/javascripts/lunr/min/lunr.es.min.js | 18 + assets/javascripts/lunr/min/lunr.fi.min.js | 18 + assets/javascripts/lunr/min/lunr.fr.min.js | 18 + assets/javascripts/lunr/min/lunr.he.min.js | 1 + assets/javascripts/lunr/min/lunr.hi.min.js | 1 + assets/javascripts/lunr/min/lunr.hu.min.js | 18 + assets/javascripts/lunr/min/lunr.hy.min.js | 1 + assets/javascripts/lunr/min/lunr.it.min.js | 18 + assets/javascripts/lunr/min/lunr.ja.min.js | 1 + assets/javascripts/lunr/min/lunr.jp.min.js | 1 + assets/javascripts/lunr/min/lunr.kn.min.js | 1 + assets/javascripts/lunr/min/lunr.ko.min.js | 1 + assets/javascripts/lunr/min/lunr.multi.min.js | 1 + assets/javascripts/lunr/min/lunr.nl.min.js | 18 + assets/javascripts/lunr/min/lunr.no.min.js | 18 + assets/javascripts/lunr/min/lunr.pt.min.js | 18 + assets/javascripts/lunr/min/lunr.ro.min.js | 18 + assets/javascripts/lunr/min/lunr.ru.min.js | 18 + assets/javascripts/lunr/min/lunr.sa.min.js | 1 + .../lunr/min/lunr.stemmer.support.min.js | 1 + assets/javascripts/lunr/min/lunr.sv.min.js | 18 + assets/javascripts/lunr/min/lunr.ta.min.js | 1 + assets/javascripts/lunr/min/lunr.te.min.js | 1 + assets/javascripts/lunr/min/lunr.th.min.js | 1 + assets/javascripts/lunr/min/lunr.tr.min.js | 18 + assets/javascripts/lunr/min/lunr.vi.min.js | 1 + assets/javascripts/lunr/min/lunr.zh.min.js | 1 + assets/javascripts/lunr/tinyseg.js | 206 + assets/javascripts/lunr/wordcut.js | 6708 +++++++++++++++++ .../workers/search.07f07601.min.js | 42 + .../workers/search.07f07601.min.js.map | 7 + assets/stylesheets/main.35f28582.min.css | 1 + assets/stylesheets/main.35f28582.min.css.map | 1 + assets/stylesheets/palette.06af60db.min.css | 1 + .../stylesheets/palette.06af60db.min.css.map | 1 + css/custom.css | 11 + .../configuring-the-github-secrets/index.html | 3006 ++++++++ deployment/environment-variables/index.html | 3180 ++++++++ endpoints/index.html | 2984 ++++++++ essential/4geeks/actions/index.html | 3057 ++++++++ .../services/first-party/token/index.html | 3012 ++++++++ .../first-party/using-services/index.html | 3320 ++++++++ .../first-party/writing-services/index.html | 3203 ++++++++ .../4geeks/services/introduction/index.html | 3100 ++++++++ essential/aiohttp/index.html | 3003 ++++++++ essential/celery/calling/index.html | 3086 ++++++++ essential/celery/introduction/index.html | 3077 ++++++++ essential/celery/tasks/index.html | 3003 ++++++++ .../introduction/index.html | 3061 ++++++++ .../serializers/index.html | 3082 ++++++++ .../validators/index.html | 3057 ++++++++ .../django-rest-framework/views/index.html | 3274 ++++++++ essential/django/admin/index.html | 3149 ++++++++ essential/django/commands/index.html | 3117 ++++++++ essential/django/introduction/index.html | 3099 ++++++++ essential/django/models/index.html | 3150 ++++++++ essential/django/signals/index.html | 3197 ++++++++ essential/django/templates/index.html | 3109 ++++++++ essential/django/urls/index.html | 3097 ++++++++ essential/django/views/index.html | 3194 ++++++++ essential/requests/index.html | 3003 ++++++++ essential/serpy/index.html | 3148 ++++++++ .../works-locally/devcontainer/index.html | 3189 ++++++++ .../works-locally/introduction/index.html | 3249 ++++++++ .../setup/works-locally/on-host-os/index.html | 3276 ++++++++ .../works-on-the-cloud/codespaces/index.html | 3134 ++++++++ .../works-on-the-cloud/gitpod/index.html | 3115 ++++++++ .../introduction/index.html | 3117 ++++++++ images/codespaces.png | Bin 0 -> 37723 bytes images/dockerhub.PNG | Bin 0 -> 127183 bytes images/github-secrets.PNG | Bin 0 -> 82390 bytes images/vs-button.png | Bin 0 -> 536 bytes index.html | 2993 ++++++++ .../environment-variables/index.html | 3082 ++++++++ infrastructure/infra-env/index.html | 3880 ++++++++++ infrastructure/journal/index.html | 3222 ++++++++ .../studies/django-workers/index.html | 3495 +++++++++ .../studies/http-clients/index.html | 3420 +++++++++ infrastructure/web/index.html | 3275 ++++++++ installation/fixtures/index.html | 3077 ++++++++ objects.inv | Bin 0 -> 844 bytes search/search_index.json | 1 + security/authentication-class/index.html | 3072 ++++++++ security/capabilities/index.html | 3374 +++++++++ security/introduction/index.html | 3076 ++++++++ security/schema-link/index.html | 3252 ++++++++ .../google-cloud-functions/index.html | 3159 ++++++++ services/google_cloud/storage/index.html | 3342 ++++++++ services/slack integration/icons/index.html | 3001 ++++++++ signals/quickstart/index.html | 3161 ++++++++ sitemap.xml | 291 + sitemap.xml.gz | Bin 0 -> 892 bytes testing/mixins/bc-cache/index.html | 3153 ++++++++ testing/mixins/bc-check/index.html | 4269 +++++++++++ testing/mixins/bc-database/index.html | 5669 ++++++++++++++ testing/mixins/bc-datetime/index.html | 3391 +++++++++ testing/mixins/bc-fake/index.html | 2999 ++++++++ testing/mixins/bc-format/index.html | 4919 ++++++++++++ testing/mixins/bc-random/index.html | 3465 +++++++++ testing/mixins/bc-request/index.html | 3874 ++++++++++ testing/mixins/bc/index.html | 3529 +++++++++ testing/mocks/mock-requests/index.html | 3990 ++++++++++ testing/mocks/using-mocks/index.html | 3200 ++++++++ testing/parametrize/index.html | 3091 ++++++++ testing/running-tests/index.html | 3176 ++++++++ workflows/file-uploading/index.html | 3433 +++++++++ 127 files changed, 245224 insertions(+) create mode 100644 .nojekyll create mode 100644 404.html create mode 100644 4geeks-libraries/index.html create mode 100644 advanced/celery/application/index.html create mode 100644 advanced/celery/canvas/index.html create mode 100644 advanced/celery/periodic-tasks/index.html create mode 100644 advanced/celery/routing/index.html create mode 100644 advanced/celery/settings/index.html create mode 100644 apps/activities/index.html create mode 100644 apps/admissions/index.html create mode 100644 apps/monitoring/introduction/index.html create mode 100644 apps/monitoring/scripts/index.html create mode 100644 assets/_mkdocstrings.css create mode 100644 assets/images/favicon.png create mode 100644 assets/javascripts/bundle.56dfad97.min.js create mode 100644 assets/javascripts/bundle.56dfad97.min.js.map create mode 100644 assets/javascripts/lunr/min/lunr.ar.min.js create mode 100644 assets/javascripts/lunr/min/lunr.da.min.js create mode 100644 assets/javascripts/lunr/min/lunr.de.min.js create mode 100644 assets/javascripts/lunr/min/lunr.du.min.js create mode 100644 assets/javascripts/lunr/min/lunr.el.min.js create mode 100644 assets/javascripts/lunr/min/lunr.es.min.js create mode 100644 assets/javascripts/lunr/min/lunr.fi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.fr.min.js create mode 100644 assets/javascripts/lunr/min/lunr.he.min.js create mode 100644 assets/javascripts/lunr/min/lunr.hi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.hu.min.js create mode 100644 assets/javascripts/lunr/min/lunr.hy.min.js create mode 100644 assets/javascripts/lunr/min/lunr.it.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ja.min.js create mode 100644 assets/javascripts/lunr/min/lunr.jp.min.js create mode 100644 assets/javascripts/lunr/min/lunr.kn.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ko.min.js create mode 100644 assets/javascripts/lunr/min/lunr.multi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.nl.min.js create mode 100644 assets/javascripts/lunr/min/lunr.no.min.js create mode 100644 assets/javascripts/lunr/min/lunr.pt.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ro.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ru.min.js create mode 100644 assets/javascripts/lunr/min/lunr.sa.min.js create mode 100644 assets/javascripts/lunr/min/lunr.stemmer.support.min.js create mode 100644 assets/javascripts/lunr/min/lunr.sv.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ta.min.js create mode 100644 assets/javascripts/lunr/min/lunr.te.min.js create mode 100644 assets/javascripts/lunr/min/lunr.th.min.js create mode 100644 assets/javascripts/lunr/min/lunr.tr.min.js create mode 100644 assets/javascripts/lunr/min/lunr.vi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.zh.min.js create mode 100644 assets/javascripts/lunr/tinyseg.js create mode 100644 assets/javascripts/lunr/wordcut.js create mode 100644 assets/javascripts/workers/search.07f07601.min.js create mode 100644 assets/javascripts/workers/search.07f07601.min.js.map create mode 100644 assets/stylesheets/main.35f28582.min.css create mode 100644 assets/stylesheets/main.35f28582.min.css.map create mode 100644 assets/stylesheets/palette.06af60db.min.css create mode 100644 assets/stylesheets/palette.06af60db.min.css.map create mode 100644 css/custom.css create mode 100644 deployment/configuring-the-github-secrets/index.html create mode 100644 deployment/environment-variables/index.html create mode 100644 endpoints/index.html create mode 100644 essential/4geeks/actions/index.html create mode 100644 essential/4geeks/services/first-party/token/index.html create mode 100644 essential/4geeks/services/first-party/using-services/index.html create mode 100644 essential/4geeks/services/first-party/writing-services/index.html create mode 100644 essential/4geeks/services/introduction/index.html create mode 100644 essential/aiohttp/index.html create mode 100644 essential/celery/calling/index.html create mode 100644 essential/celery/introduction/index.html create mode 100644 essential/celery/tasks/index.html create mode 100644 essential/django-rest-framework/introduction/index.html create mode 100644 essential/django-rest-framework/serializers/index.html create mode 100644 essential/django-rest-framework/validators/index.html create mode 100644 essential/django-rest-framework/views/index.html create mode 100644 essential/django/admin/index.html create mode 100644 essential/django/commands/index.html create mode 100644 essential/django/introduction/index.html create mode 100644 essential/django/models/index.html create mode 100644 essential/django/signals/index.html create mode 100644 essential/django/templates/index.html create mode 100644 essential/django/urls/index.html create mode 100644 essential/django/views/index.html create mode 100644 essential/requests/index.html create mode 100644 essential/serpy/index.html create mode 100644 getting-started/setup/works-locally/devcontainer/index.html create mode 100644 getting-started/setup/works-locally/introduction/index.html create mode 100644 getting-started/setup/works-locally/on-host-os/index.html create mode 100644 getting-started/setup/works-on-the-cloud/codespaces/index.html create mode 100644 getting-started/setup/works-on-the-cloud/gitpod/index.html create mode 100644 getting-started/setup/works-on-the-cloud/introduction/index.html create mode 100644 images/codespaces.png create mode 100644 images/dockerhub.PNG create mode 100644 images/github-secrets.PNG create mode 100644 images/vs-button.png create mode 100644 index.html create mode 100644 infrastructure/environment-variables/index.html create mode 100644 infrastructure/infra-env/index.html create mode 100644 infrastructure/journal/index.html create mode 100644 infrastructure/studies/django-workers/index.html create mode 100644 infrastructure/studies/http-clients/index.html create mode 100644 infrastructure/web/index.html create mode 100644 installation/fixtures/index.html create mode 100644 objects.inv create mode 100644 search/search_index.json create mode 100644 security/authentication-class/index.html create mode 100644 security/capabilities/index.html create mode 100644 security/introduction/index.html create mode 100644 security/schema-link/index.html create mode 100644 services/google_cloud/google-cloud-functions/index.html create mode 100644 services/google_cloud/storage/index.html create mode 100644 services/slack integration/icons/index.html create mode 100644 signals/quickstart/index.html create mode 100644 sitemap.xml create mode 100644 sitemap.xml.gz create mode 100644 testing/mixins/bc-cache/index.html create mode 100644 testing/mixins/bc-check/index.html create mode 100644 testing/mixins/bc-database/index.html create mode 100644 testing/mixins/bc-datetime/index.html create mode 100644 testing/mixins/bc-fake/index.html create mode 100644 testing/mixins/bc-format/index.html create mode 100644 testing/mixins/bc-random/index.html create mode 100644 testing/mixins/bc-request/index.html create mode 100644 testing/mixins/bc/index.html create mode 100644 testing/mocks/mock-requests/index.html create mode 100644 testing/mocks/using-mocks/index.html create mode 100644 testing/parametrize/index.html create mode 100644 testing/running-tests/index.html create mode 100644 workflows/file-uploading/index.html diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 000000000..e69de29bb diff --git a/404.html b/404.html new file mode 100644 index 000000000..59ac64512 --- /dev/null +++ b/404.html @@ -0,0 +1,2956 @@ + + + +
+ + + + + + + + + + + + + + +Celery needs an object called application, this object is bound with a set of configurations like the Message Broker or task queue, theoretically you should have many celery apps and bound your tasks to one or many of those apps, actually we had not got any use to this feature and we rather use the shared_task decorator instead which just support one application.
+Read this.
+It where in breathecode/celery.py
.
Celery allows configure some tasks to be executed repeatedly separate by a period of time, it usually did not use in favor of Django commands.
+Read this.
+ + + + + + + + + + + + + +Celery allows set custom routing to call its tasks, it is usually used when you use Celery as a Message Broker, actually use Celery for this purpose is complicated because Celery does not support other Programming languages, so, you would have to use the Message Broker that Celery is using instead.
+Read this.
+ + + + + + + + + + + + + +This API uses Google DataStore as storage, there is not local storage on Heroku or Postgres.
+We need Google DataStore because we plan to store huge amounts of activities that the user can do inside breathecode.
+Possible activities (so far): +
"breathecode_login" //every time it logs in
+"online_platform_registration" //first day using breathecode
+"public_event_attendance" //attendy on an eventbrite event
+"classroom_attendance" //when the student attent to class
+"classroom_unattendance" //when the student miss class
+"lesson_opened" //when a lessons is opened on the platform
+"office_attendance" //when the office raspberry pi detects the student
+"nps_survey_answered" //when a nps survey is answered by the student
+"exercise_success" //when student successfully tests exercise
+
Any activity has the following inputs:
+ +Get recent user activity +
+Add a new user activity (requires authentication) +
POST: activity/user/{email_or_id}
+{
+ 'slug' => 'activity_slug',
+ 'data' => 'any aditional data (string or json-encoded-string)'
+}
+
+💡 Node: You can pass the cohort in the data json object and it will be possible to filter on the activity graph like this:
+
+{
+ 'slug' => 'activity_slug',
+ 'data' => "{ \"cohort\": \"mdc-iii\" }" (json encoded string with the cohort id)
+}
+
Endpoints for the Cohort
+Get recent user activity +
+Endpoints for the coding_error's + +Add a new coding_error (requires authentication)
+POST: activity/coding_error/
+
+{
+ "user_id" => "my@email.com",
+ "slug" => "webpack_error",
+ "data" => "optional additional information about the error",
+ "message" => "file not found",
+ "name" => "module-not-found,
+ "severity" => "900",
+ "details" => "stack trace for the error as string"
+}
+
This module take care of the academic side of breathecode: Students, Cohorts, Course (aka: Certificate), Syllabus, etc. These are some of the things you can do with the breathecode.admissions API:
+TODO: finish this documentation.
+Override previous academies +
+This app is ideal for running diagnostic and reminders on the breathecode platform.
+Setup the monitor app job for once a day, this is the command: +
+Setup the monitor script job for once a day, this is the command: +
+A monitoring script is something that you want to execute recurrently withing the breathecode API, for example:
+scripts/alert_pending_leads.py
is a small python script that checks if there is FormEntry Marketing module database that are pending processing.
You can create a monitoring script to remind academy staff members about things, or to remind students about pending homework, etc.
+./breathecode/monitoring/scripts
#!/usr/bin/env python
+"""
+Alert when there are Form Entries with status = PENDING
+"""
+from breathecode.utils import ScriptNotification
+# start your code here
+
ScriptNotification
to notify for MINOR
or CRITICAL
reasons, for example:# here we are raising a notification because there are 2 pending tasks
+raise ScriptNotification("There are 2 pending taks", status='MINOR', slug="pending_tasks")
+
There are some global variables that you have available during your scripts:
+Variable name | +Value | +
---|---|
academy | +Contains the academy model object, you can use it to retrieve the current academy id like this: query.filter(academy__id=academy.id) |
+
You can test your scripts by running the following command:
+$ python manage.py run_script <file_name>
+
+# For example you can test the alert_pending_leads script like this:
+$ python manage.py run_script alert_pending_leads.py
+
The following script checks for pending leads to process:
+#!/usr/bin/env python
+"""
+Alert when there are Form Entries with status = PENDING
+"""
+from breathecode.marketing.models import FormEntry
+from django.db.models import Q
+from breathecode.utils import ScriptNotification
+
+# check the database for pending leads
+pending_leads = FormEntry.objects.filter(storage_status="PENDING").filter(Q(academy__id=academy.id) | Q(location=academy.slug))
+
+# trigger notification because pending leads were found
+if len(pending_leads) > 0:
+ raise ScriptNotification(f"Warning there are {len(pending_leads)} pending form entries", status='MINOR')
+
+# You can print this and it will show on the script results
+print("No pending leads")
+
from breathecode.monitoring.actions import run_script
+script = run_script(model.monitor_script)
+
+del script['slack_payload']
+del script['title']
+
+expected = {'details': script['details'],
+ 'severity_level': 5,
+ 'status': script['status'],
+ 'text': script['text']
+ }
+
+self.assertEqual(script, expected)
+
+self.assertEqual(self.all_monitor_script_dict(), [{
+ **self.model_to_dict(model, 'monitor_script'),
+}])
+