Development environment should have a project

Description of the limitation and why it is relevant to address

As a developer, I want the development environment to mock or simulate having a project so that the behavior matches the deployed application.

I think this is relevant for the VIKTOR platform because differences between the deployed application and the development environment can lead to unexpected behaviors.

Example of the Problem

In the deployed application, I can access the following project information without issue:
image

However, when testing locally with viktor-cli start , the same functionality does not work:
image
*Meaning there is no value but this is problematic if I access it

Submitter proposed design (optional)

Just some ideas:

  1. Return a mock project (entirely decided by VIKTOR, the developer does nothing)
  2. Provide an option in the .toml configuration file (or elsewhere) to specify mock project values that will be used in the development environment.

Current workarounds

Currently, I have adapted our own code to handle this. This can be done pretty easily/fast and we did not have any issues. I thought it worth mentioning nonetheless.

Thanks for your feature request!

Do i understand it correctly that you now have something like the following in your app code and would like to get rid of it?

if project is None:  # in development
    # mock
else:  # in production
   # use project
1 Like
  1. Yes, as of today we have something similar to what you mentionned.

  2. Yes, we would like to get rid of it.

  3. We also have the following alternative:

import platform
IS_DEPLOYED = platform.system() == 'Linux'

While the deployed application seems to run on Linux, our computers run with Windows so we are able to separate both cases using:

if IS_DEPLOYED: # in production
   # ...
else:  # in development
   # ...

This is also similar in principle.

Clear, thanks for the extra context.