WayScript allows you to configure your Lair to host a running microservice in minutes. Follow this guide to setup a simple Django app in your Lair.
{% embed url="https://youtu.be/LoXVosOzvJg" %}
Create a requirements.txt
file in your Lair’s root directory and specify the django package. You can install the django package via pip
in your Lair Terminal. You can also specify any additional dependencies your app requires. See Hosted environments for more details.
pip install django
pip freeze > requirements.txt
Enter into the Terminal:
django-admin startproject mysite
This creates your Django project
{% hint style="info" %}
mysite
can be changed to whatever you want as a project name
{% endhint %}
Open your Lair’s .triggers
file and add a new deploy
trigger. Create a name for your trigger and input the following run command and port number 8080
(or modified command and port number based on your app requirements). See Triggers for more details.
python mysite/manage.py runserver 0.0.0.0:8080
Once your project is created, Django will require the domain that hosts your application to be added to the settings.py
file in your application directory. You can grab the domain from your Deploy Trigger or from the Endpoints tab.
ALLOWED_HOSTS = ['<DOMAIN_FROM_DEPLOY_TRIGGER>']
Press “Run” to execute the run command and start your web server process (see Processes for more details). Navigate to the *.wayscript.cloud
endpoint generated to see your Flask app in action!
Once you have finished testing, press “Deploy” to create a production environment for your Flask app. Select <Lair_name>.prod
in the Lair selector menu and view the on deploy
trigger to access your app’s production endpoint. See Hosted environments for more details.
{% hint style="warning" %} By default, your Lair's endpoints are protected against unauthenticated requests. See endpoints.md on how to public expose your endpoints or authenticate using your application key. {% endhint %}