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
Proper use of environment variables allows flexible deployment and integration of Serverless ADR
213
-
into diverse environments, including containerized, cloud, or on-premises infrastructures.
214
-
215
-
See also the :doc:`configuration` and :doc:`setup` guides for comprehensive initialization instructions.
216
-
217
158
**Note: Prefer constructor parameters for new projects. Environment variables remain supported primarily for legacy compatibility.**
218
159
219
160
Best Practices
@@ -252,50 +193,6 @@ Examples
252
193
)
253
194
adr.setup(collect_static=True)
254
195
255
-
**Multi-database PostgreSQL and SQLite setup:**
256
-
257
-
.. code-block:: python
258
-
259
-
database_config = {
260
-
"default": {
261
-
"ENGINE": "postgresql",
262
-
"NAME": "adr_db",
263
-
"USER": "adr_user",
264
-
"PASSWORD": "password",
265
-
"HOST": "localhost",
266
-
"PORT": "5432",
267
-
},
268
-
"sqlite_local": {
269
-
"ENGINE": "sqlite3",
270
-
"NAME": r"C:\Reports\DB\local.sqlite3",
271
-
},
272
-
}
273
-
274
-
adr = ADR(
275
-
ansys_installation=r"/opt/ansys",
276
-
databases=database_config,
277
-
media_directory=r"/opt/reports/media",
278
-
static_directory=r"/opt/reports/static",
279
-
media_url="/media/",
280
-
static_url="/static/",
281
-
)
282
-
adr.setup()
283
-
284
-
**Docker-based Ansys installation:**
285
-
286
-
.. code-block:: python
287
-
288
-
adr = ADR(
289
-
ansys_installation="docker",
290
-
docker_image="ghcr.io/ansys-internal/nexus_dev",
291
-
db_directory=r"C:\Reports\DB",
292
-
media_directory=r"C:\Reports\Media",
293
-
static_directory=r"C:\Reports\Static",
294
-
media_url="/media/",
295
-
static_url="/static/",
296
-
)
297
-
adr.setup()
298
-
299
196
Troubleshooting
300
197
---------------
301
198
@@ -312,11 +209,5 @@ Troubleshooting
312
209
Summary
313
210
-------
314
211
315
-
Proper configuration of Serverless ADR ensures seamless database connections, media management, and web serving of report assets. Follow best practices for setup and environment initialization to avoid common issues.
316
-
317
-
Next Steps
318
-
----------
319
-
320
-
See the :doc:`setup` guide for detailed startup and initialization instructions.
321
-
322
-
See the :doc:`media_and_static` guide for managing static and media files in your reports.
212
+
Proper configuration of Serverless ADR ensures seamless database connections, media management, and web serving of report assets.
213
+
Follow best practices for setup and environment initialization to avoid common issues.
Copy file name to clipboardExpand all lines: doc/source/serverless/items.rst
+8-3Lines changed: 8 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,7 +41,6 @@ Items automatically link to the current default session and dataset unless speci
41
41
content="This simulation demonstrates fluid flow around a wing.",
42
42
tags="section=summary project=wing_sim",
43
43
)
44
-
string_item.save()
45
44
46
45
# Create a table item with data
47
46
data = np.array(
@@ -71,7 +70,10 @@ Item Properties and Metadata
71
70
72
71
Items support several useful properties and metadata fields:
73
72
73
+
- **guid**: Unique identifier for the item, automatically generated.
74
74
- **name**: Unique identifier for the item within the dataset.
75
+
- **type**: The item type (e.g., `string`, `table`, etc.).
76
+
- **date**: Timestamp indicating when the item was created.
75
77
- **content**: The primary payload of the item, type-dependent.
76
78
- **tags**: A space-separated string of key or key=value tags for querying and filtering.
77
79
- **source**: String to track the data origin or generating process.
@@ -94,7 +96,6 @@ Example: Creating and saving an image item
94
96
content="path/to/wing_profile.png",
95
97
tags="section=images project=wing_sim",
96
98
)
97
-
image_item.save()
98
99
99
100
After saving, the file is copied into the configured media directory. You can access the uploaded file's storage path using the `file_path` property:
100
101
@@ -106,7 +107,8 @@ After saving, the file is copied into the configured media directory. You can ac
106
107
This path points to the location within the media directory configured during ADR setup.
107
108
You can use this path for verification, further processing, or serving the media file in your application.
108
109
109
-
When rendering reports or templates that include media items, the HTML references media files using relative URLs, typically prefixed by the configured media URL (default is `/media/`):
110
+
When rendering reports or templates that include media items, the HTML references media files using relative URLs,
111
+
typically prefixed by the configured media URL (default is `/media/`):
110
112
111
113
.. code-block:: html
112
114
@@ -118,7 +120,10 @@ Ensure your web server is configured to serve these media URLs from the media di
118
120
Summary:
119
121
- Set the `content` of file-based items to the local file path before saving.
120
122
- After saving, `file_path` gives the full path to the uploaded media file.
123
+
- When the item is loaded again from the database, `content` will be the relative path to the media file.
121
124
- Rendered reports use relative media URLs; configure your web server accordingly.
125
+
- Use the `media_url` property to get the URL prefix for serving media files.
126
+
- The media URL is typically `/media/` by default.
0 commit comments