0% found this document useful (0 votes)
8 views4 pages

Backend Deployment

Uploaded by

samnjogu2753
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views4 pages

Backend Deployment

Uploaded by

samnjogu2753
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Detailed Steps for Running and Managing Sema Mobile App

1. Install Flutter:
○ Follow the instructions on the Flutter install page to install Flutter on your
machine.
2. Set Up Android Studio/Xcode:
○ Android Studio: Install and configure Android Studio. Ensure you have the
Android SDK installed.
○ Xcode: Install Xcode from the App Store if you are targeting iOS.
3. Prepare the Mobile App:
○ Open a terminal and navigate to the Sema-mobile-main directory:
cd path/to/Sema-mobile-main
○ Fetch the dependencies:
flutter pub get
○ Run the app on an emulator or connected device:
flutter run

○ If you encounter issues, ensure you have the necessary Flutter and Dart SDK
paths set in your environment variables.

4. Build the Mobile App for Release:

Android:
flutter build apk

○ The generated APK will be in the build/app/outputs/flutter-apk/


directory.

iOS:
flutter build ios

● Follow the instructions in the Flutter iOS deployment guide for additional steps like
setting up provisioning profiles and signing certificates.

Detailed Steps for Running and Managing Sema Backend


1. Install Python and Set Up Virtual Environment:
○ Install Python from python.org.

Create and activate a virtual environment:

python -m venv venv


source venv/bin/activate # On Windows use `venv\Scripts\activate`


2. Navigate to Backend Directory:

Open a terminal and navigate to the sema-top-backend-main directory:

cd path/to/sema-top-backend-main


3. Install Dependencies:

Install the dependencies listed in requirements.txt:

pip install -r requirements.txt


4. Configure the Application:

Open the settings.py file in the Django project and configure your database settings. For
example, if you are using PostgreSQL:
python

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'your_db_name',
'USER': 'your_db_user',
'PASSWORD': 'your_db_password',
'HOST': 'localhost',
'PORT': '5432',
}
}


○ Set up environment variables as needed.
5. Apply Database Migrations:

Run the following command to apply migrations:

python manage.py migrate



6. Run the Development Server:

Start the Django development server:

python manage.py runserver


○ Access the server at http://127.0.0.1:8000/.

Deploying Backend on Heroku


1. Login to Heroku:
○ Ensure you have the Heroku CLI installed.

Log in to your Heroku account:

heroku login


2. Create a New Heroku App:

Create a new app:

heroku create


3. Set Up Database:

Add the PostgreSQL addon:

heroku addons:create heroku-postgresql:hobby-dev


4. Set Up Environment Variables:
○ Configure your environment variables on Heroku (e.g., SECRET_KEY, DEBUG,
DATABASE_URL).
5. Deploy to Heroku:

Ensure you have a Procfile in your project directory with the following content:
c

web: gunicorn sema.wsgi --log-file -


Initialize a git repository if you haven’t already:

git init
git add .
git commit -m "Initial commit"

Pu the code to Heroku:

git pu heroku main


6. Run Database Migrations on Heroku:

Run the following command to apply migrations on Heroku:

heroku run python manage.py migrate

Monitoring and Managing Your Deployments


● Heroku Daboard: Use the Heroku Daboard to monitor the status, logs, and
performance of your deployed app.
● Logging: Set up logging using Heroku’s logging tools to monitor your app for errors and
performance issues.
● Scaling: Scale your app as needed by adding more dynos via the Heroku Daboard or
CLI.

You might also like