My first ViUR Project¶
After completing the first steps in the Google Cloud Console you can start programming your first ViUR Application. To start, you will need to set up you ViUR system locally.
Warning
Before performing the following steps, please make sure to visit Awesome ViUR
and perform the ViUR setup steps for your operating system.
Start with ViUR¶
Install the ViUR CLI Tool in your standard python environment:
pip install viur-cli
Check your installation success
which viur
# The console output should look like this:
/home/user/.local/bin/viur
Create a new local ViUR project for the App Engine project you have already created
Note
If you don’t know about this, please revisit “ViUR and the Google Cloud Console”
viur create projectnameThis command will prompt you to enter a application name and a develop version name. We recommend naming the application name after your App Engine project. The develop version name should be the same, but with a “-dev” postfix.
application name: projectname develop version name: projectname-dev3.1. Choose if you want to use a prebuild version of ViUR Vi
3.2. Choose if you want to add ViUR Vi as a git submodule
3.3. Choose if you want to configure your project as a new gcloud project
Install your development dependencies
Since we want to have the flexibility to work on different versions of our software, we use virtual environments. You can find more information about pipenv here.
pipenv install --dev
Check your installation success.
$EDITOR PipfileYour output should look like this.
[[source]] url = "https://pypi.org.sample" verify_ssl = true name = "pypi" [packages] viur-core = "*" [dev-packages] viur-cli = "*" pycodestyle = "*" watchdog = "*" [requires] python_version = "3.11"
Start your pipenv
pipenv shell
This command will start a new virtual environment, installing packages in this environment will not install anything globally. So feel free to fool around and experiment with packages.
Finish you GCloud setup
#This script enables API's and configures some more App Engine stuff ./viur-gcloud-setup.sh projectname
Try out your installation by running your dev server
viur run
Warning
On the first start of your development server, the debug output will show you username and password credentials for an automatically generated admin user.You can log into the Vi and change both the username and password by hand afterwards.It will look similar to this:#ViUR created a new admin-user for you! #Username: admin@projectname-viur.com #Password: ThisIsARandomStr1ng!
Open http://localhost:8080 and http://localhost:8080/vi to check if the front and backend of your system is working.
After your first deployment open https://appspot.com
Visit the IAM & Admin and press the “+ GRANT ACCESS” Button
Select the user: “projectname@appspot.gserviceaccount.com”
Assign following roles:
Cloud Datastore User
Storage Object Admin
Reset my admin user:¶
In case you have locked yourself out of your own system. There is a possible way back in, but you will need to sacrifice all your user data and log ins.
Warning
All your user data will be deleted in the App Engine and it will not be recoverable. We only recommend this, if you see no other option of logging into your administration system
Note
The ViUR-Developers recommend the usage of a Password Manager
Open https://console.cloud.google.com and navigate to your project
Navigate to the Datastore Entities Site of your project.
Search and delete all entries of the kind user
Search and delete all entries of the kind user_name_uniquePropertyIndex
Start your dev server again
Optional:
Recover from stress and anxiety