Skip to content

sefire-octopi/adxpand-cloud

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The {product name} API Project

a proud OCTOPI project

Contents

Overview

{product name}©️ is a digital infrastructure that enables clients to visualize data from Search Engine Marketing(SEM) campaigns at a microscopic level, marrying the business logic of clients together with the data from sales campaigns to help companies align their campaign objectives and methodology with their SEM campaigns.

This project is a private project and further information regarding the specific business logic of {product name}:copyright: can only be obtained by request to the maintainer of this GitHub©️ repository.

All the Tech

Click on the links to read more about the technologies in the respective repositories!

Languages Used

  1. Python 3.9 or greater
  2. MySQL 8.0

Frameworks

  1. django + django REST Framework

Libraries

  1. pandas
  2. Google Ads API Python Client Library

Subsidiary Technologies

  1. Google Ads API
  2. Google Cloud Platform

Some "Pre-Requisites" Before We Begin...

For an in-depth walk-through for setting up an entire project on GCP, it is best to refer back to the Google Cloud Platform (GCP) docs to see how a Django project is set up on GCP and how to configure a GCP project yourself (alternatively, create your own project!).

This tutorial will walk you through on how to configure your own GCP Project with django.

DISCLAIMER AND REITERATION: This GitHub is not meant to teach you how to set up on GCP. Do note that knowledge on how Django is set up on GCP is NOT REQUIRED as the set up has already been taken care of during the configuration of this repository.

This tutorial will walk you through on how to start working on this project with GIT

This tutorial will walk you through on how to use an IDE together with GIT

Alternatively, head over to BuildIT.Io's introduction page for all the things a new developer needs to know.

Lastly, ensure the owner of this project has provided you an organisation email and added you into the project. the email should look something like yourname@organisation.page or yourname@organisation.com. If you do not have this information, the next few instructions will not work for you.

Getting Started

  1. Clone this repository into a desired folder

  2. Create a virtual environment using your IDE (we recommend strictly following the procedure of your IDE rather than using the in built command line and running virtualenv new-env to create the virtual environment). Place the location of your environment at the same level where the .gitignore file is. You may also be prompted to use a requirements.txt file to download all necessary packages. This can be found in the \amplifyIo directory.

  3. Test if your virtual environment has been created successfully by running

    For Mac/Linux:

    new-env/bin/activate
    

    For Windows:

    new-env\Scripts\activate
    

    Always remember to be running from the correct directory where your new-env is. if successful you should see something similar to below:

    (new-env) MyComputer\User-19982: $
    

    If the activate comd generates the message "Activate.ps1 is not digitally signed. You cannot run this script on the current system, use this cmd

    Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process
    
  4. Download Google Cloud SDK

  5. Download Cloud SQL Proxy (we recommend placing this file in the same location as where the Google CLoud SDK Program is kept, although it should not matter since Cloud SQL Proxy can technically run from any directory in the command line)

  6. Open and run the Google Cloud SDK.

  7. Next, we need to connect to the Google Cloud Server to even begin making edits.

    For First Time Users: first time users need to

    • get username n pw from owner
    • run gcloud auth login on cmd line, a pop out page in yr browser will appear
    • login via the above username n pw

    After all the above first time users steps are completed, proceed with the steps below

    For Window Users:

    cloud_sql_proxy.exe --instances="amplifyio-308412:asia-southeast1:amplify-io"=tcp:3307
    

    For Mac/Linux Users:

    .\cloud_sql_proxy -instances="amplifyio-308412:asia-southeast1:amplify-io"=tcp:3307
    

    At times you may try to connect and result in the following error:

    Can't connect to MySQL server on '127.0.0.1' (3306)
    

    This is completely normal if you already downloaded MySQL or equivalent technologies in your computer as 3306 is usually the main port for servers to listen for calls on. In such cases, just check which ports are open on your computer and substitute 3306 with an available port provided by the computer. Keep this running throughout the development process.

    Otherwise you should see this

    ready for new connections
    
  8. Now, we need to install all the dependencies into the virtual environement you created in 2 if this has not been done. On the terminal, actiavte your environement and run the following command:

    pip install -r requirements.txt
    
  9. Once all this is done, we can then run django normally. Navigate to the folder with the manage.py file and start a local web server.

    python manage.py runserver
    

    Then, in your browser, proceed to

    http://localhost:8000
    
  10. Add an account to use the django admin console (signing in and viewing the databases from the built-in admin page on django)

    python manage.py createsuperuser
    

    Follow the prompts, then restart your local web server again.

You can now make changes to your django project. Here are some reminders when making changes visible on the local web server.

Making Changes

With django, you need to enter a few standard commands everytime changes are made. This is done by

python manage.py makemigrations
python manage.py makemigrations amplifyIoAPI-or-any-other-project
python manage.py migrate

Note to Developer:

  1. Always activate cloud_sql_proxy.exe to write local changes into the remote GCP project
  2. Stop your local webserver with Ctrl-C if you intend to use manage.py to run other functions like createsuperuser.
  3. Remember to update your urls.py and settings.py to include any new data models and urls you have built in Django
  4. Check that you are already in the environment
  5. For every new property, always start with python manage.py startproject new-property-name on the command line
  6. After adding the new environment and making the necessary changes on urls and settings, don't forget to do python manage.py makemigrations, python manage.py makemigrations new-property-name and python manage.py migrate to complete bootstrapping
  7. to check for changes, use python manage.py runserver
  8. to generate static changes, use python manage.py collectstatic
  9. finalise changes into GCP by doing gcloud app deploy

About

The amplify.Io GCP Web Project

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages