You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
3. Navigate to the Directory Sync example app within the cloned repo.
29
+
2. Navigate to the Directory Sync example app within the cloned repo.
35
30
```bash
36
31
$ cd python-django-example-applications/python-django-directory-sync-example
37
32
````
38
33
39
34
### Install Dependencies
40
35
41
-
4. Create and source a Python virtual environment. You should then see `(env)` at the beginning of your command-line prompt.
36
+
3. Create and source a Python virtual environment. You should then see `(env)` at the beginning of your command-line prompt.
42
37
```bash
43
38
$ python3 -m venv env
44
39
$ source env/bin/activate
45
40
(env) $
46
41
```
47
42
48
-
5. Install the cloned app's dependencies. If the `pip` command doesn't work, try `pip3` instead.
43
+
4. Install the cloned app's dependencies. If the `pip` command doesn't work, try `pip3` instead.
49
44
```bash
50
45
(env) $ pip install -r requirements.txt
51
46
```
52
47
53
48
### Set Environment Variables
54
49
55
-
6. Obtain and make note of the following values. In the next step, these will be set as environment variables.
50
+
5. Obtain and make note of the following values. In the next step, these will be set as environment variables.
56
51
- Your [WorkOS API key](https://dashboard.workos.com/api-keys)
57
52
- Your `WEBHOOKS_SECRET`, retrievable from the URL in the WEBHOOKS area of the WorkOS dashboard. This is only required if you are utilizing the webhooks route of this application to receive and validate webhook events.
58
53
59
-
7. Ensure you're in the root directory for the example app, `python-django-directory-sync-example/`. Create a `.env` file to securely store the environment variables. Open this file with the Nano text editor. (This file is listed in this repo's `.gitignore` file, so your sensitive information will not be checked into version control.)
54
+
6. Ensure you're in the root directory for the example app, `python-django-directory-sync-example/`. Create a `.env` file to securely store the environment variables. Open this file with the Nano text editor. (This file is listed in this repo's `.gitignore` file, so your sensitive information will not be checked into version control.)
60
55
```bash
61
56
(env) $ touch .env
62
57
(env) $ nano .env
63
58
```
64
59
65
-
8. Once the Nano text editor opens, you can directly edit the `.env` file by listing the environment variables:
60
+
7. Once the Nano text editor opens, you can directly edit the `.env` file by listing the environment variables:
66
61
```bash
67
62
export WORKOS_API_KEY=<value found in step 6>
68
63
export WEBHOOKS_SECRET=<value found in step 6>
69
64
```
70
65
71
66
To exit the Nano text editor, type`CTRL + x`. When prompted to "Save modified buffer", type`Y`, then press the `Enter` or `Return` key.
72
67
73
-
9. Source the environment variables so they are accessible to the operating system.
68
+
8. Source the environment variables so they are accessible to the operating system.
74
69
```bash
75
70
(env) $ source .env
76
71
```
@@ -83,7 +78,7 @@ If you get stuck, please reach out to us at [email protected] so we can help.
83
78
84
79
### Run Django Migrations and Start Server
85
80
86
-
10. Run the Django migrations. Again, ensure you're in the `python-django-directory-sync-example/` directory where the `manange.py` file is.
81
+
9. Run the Django migrations. Again, ensure you're in the `python-django-directory-sync-example/` directory where the `manange.py` file is.
87
82
```bash
88
83
(env) $ python3 manage.py migrate
89
84
```
@@ -98,7 +93,7 @@ If you get stuck, please reach out to us at [email protected] so we can help.
98
93
. . .
99
94
```
100
95
101
-
11. Start the server.
96
+
10. Start the server.
102
97
```bash
103
98
(env) $ python3 manage.py runserver
104
99
```
@@ -120,14 +115,14 @@ If you get stuck, please reach out to us at [email protected] so we can help.
120
115
Quit the server with CONTROL-C.
121
116
```
122
117
123
-
12. Once the server is running, navigate to http://localhost:8000 to view the home page of the app where you can thenselectthe view for users or groups.
118
+
11. Once the server is running, navigate to http://localhost:8000 to view the home page of the app where you can thenselectthe view for users or groups.
124
119
125
120
- The `/users` URL corresponds to the WorkOS API's [List Directory Users endpoint](https://workos.com/docs/reference/directory-sync/user/list)
126
121
- The `/groups` URL corresponds to the WorkOS API's [List Directory Groups endpoint](https://workos.com/docs/reference/directory-sync/group/list)
127
122
- You can extend this Django example app by adding views to `directory_sync/views.py`for the other available [Directory Sync API endpoints](https://workos.com/docs/reference/directory-sync).
128
123
129
124
130
-
13. WorkOS sends Webhooks as a way of managing updates to Directory Sync connections. The Webhooks section of the WorkOS Dashboard allows you to send test webhooks to your application. The Test Webhooks section of this application allows you to visualize the validated webhooks directly in this application in real-time. [Please review the tutorial here](https://workos.com/blog/test-workos-webhooks-locally-ngrok) for details on how this can be done locally.
125
+
12. WorkOS sends Webhooks as a way of managing updates to Directory Sync connections. The Webhooks section of the WorkOS Dashboard allows you to send test webhooks to your application. The Test Webhooks section of this application allows you to visualize the validated webhooks directly in this application in real-time. [Please review the tutorial here](https://workos.com/blog/test-workos-webhooks-locally-ngrok) for details on how this can be done locally.
0 commit comments