How to use remote development for HOLON - Zenmo/Holon-webapp GitHub Wiki
Name: Dev Containers
Id: ms-vscode-remote.remote-containers
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers
Name: Remote Development
Id: ms-vscode-remote.vscode-remote-extensionpack
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack
This is the safer alternative to using a password. SSH is secure but also very powerful. That's why we prefer one of the latest and greatest in protocols (ed25519
). Never share your private key (the file without the .pub
extension). That file is yours and yours alone.
- Open bash or cmd. (will start in your user root folder
~/users/<username>/
)
cd .ssh
ssh-keygen -t ed25519
- When prompted to provide a location use
holondev_{yourname}
(replace{yourname}
by your name) - Provide no passphrase when prompted (or make sure to write that down)
- While still at
~/users/<username>/.ssh
, create a config file at that location usingnul > config
(cmd) ortouch config
(bash) - Open the file in vscode (
code config
) or notepad (notepad.exe config
) - Enter the content below to that file (replace the first part by your user path to
.ssh
and the last part by the filename of the keys you just generated)
Host holondev
HostName 167.235.148.91
User root
IdentityFile <your_user_path>/.ssh/holondev_{yourname}
- Use whatever channel to send me the
.pub
version of your key - I'll use
ssh-copy-id -f -i <your_key.pub> <myconfig_host>
to add your public key to the server. - I'll let you know once that's done
- Open VScode
- Press
ctrl+shift+p
and typeremote connect current
and select the commandRemote-SSH: Connect Current Window to Host
(id:opensshremotes.openEmptyWindowInCurrentWindow
) - Select 'Add new SSH host'
- Type
ssh holondev
- Select the correct location for your
.ssh
config (~/users/.shh/config
)
- Once connected, open the correct folder in VScode by selecting
/root/projects/Holon-webapp/
- Click the dev container notification that appears ('Reopen in Container') OR: use
ctrl+shift+p
and typereopen container
to selectRemote-Containers: Reopen in Container
The Django backend consists of 2 interfaces: the CMS (Wagtail) and the django-admin interface. The CMS is more userfriendly while django-admin exposes all models and provides a more low-level interface.
URL | Name | Functionality |
---|---|---|
http://localhost:8000/wt/cms | Wagtail CMS | Nicer interface for working with Django models, allows you to create pages and make configurations. |
http://localhost:8000/wt/admin | django-admin | The more low level interface for working with models. For now, this is where you should create your datamodel configuration. |
http://localhost:8000/wt/api/nextjs/v2/datamodel/int:pk/ | datamodel JSON endpoint |
replace the int:pk with your scenario number (can be found when editing the scenario at the end of the url (e.g., /wt/cms/scenarios/edit/1 , where 1 is the pk of this scenario. |
- Make sure the database is ready for use by you (check with other users Jorrit, Gillis & Peter).
- Open a terminal in VScode (ctrl + ~)
- run
cd src
to navigate to the Python source folder - run
python manage.py flush
(this will reset the database by erasing all entries but retains the schemas) - run
python manage.py createsuperuser
(use user: admin, email: [email protected] and pass: admin) - run
python manage.py runserver
- Navigate to the django-admin
- Add your model configuration, starting at scenario, actors, gridnodes and gridconnections. You can create 'parents' in the same window by clickin on the green plus. This will open a window for you to add the parent model information. Add assets to gridconnections using the 'gridconnection' field. Similar for gridnode. In the
json
, these will be resolved to viewsets (as list in gridconnections/gridnodes)
- In your terminal that is in the
src
folder run:
manage.py dumpdata holon --natural-primary --natural-foreign > <fixture_name>.json
Hoe doe je dit?