Skip to content
Yu Zhiqiang edited this page Aug 3, 2014 · 4 revisions

Wiki - Phimpme Generator

The whole project includes this repo and the Android app. It aims to create a photo sharing app and a generator that can customize it. This repo is the generator part, which is a website where users can customize their own photo app with their own name and own set of functions.

Django Website

Currently the website contains only one page, where users can fill in a form and get their own APK after clicking the submit button.

The way to set up the website is mentioned in README.md of this repo.

Deployment

Before deployment, please test this website following the steps for testing. If it works well, you can then follow the following steps to deploy it into a production environment.

  1. Modify HTMLs in Phimpme/static folder. Especially privacy.html where stays the user agreement
  2. Install Django
  3. Go to Phimpme/Phimpme/apps/appshop/gen_script.py you will see
    template_path = "/Users/yzq/Documents/GitHub/phimpme-android/Phimpme"
    Change it to the path of the source code of Phimp.me Android app.
  4. Create a local.properties file in Phimp.me Android app, as described in the app wiki.
  5. Go to the root of this repo and execute python manage.py syncdb to create the SQLite database file and create admin account.
  6. Execute python manage.py loaddata Phimpme/apps/appshop/appshop.json to load settings.
  7. Follow Paypal REST API Configuration part to set up the auth key of PayPal.
  8. Turn off Django's debug mode. Open Phimpme/settings.py, then change DEBUG and TEMPLATE_DEBUG into False.
  9. Deploy the Django website with a web server (e.g. Apache, Nginx). See details here: How to deploy with WSGI

Paypal REST API Configuration

Modify the PayPal auth key in settings.py to your own. The PAYPAL_MODE should be live in the production environment. You can apply for these keys on https://www.paypal.com.

PAYPAL_MODE = 'sandbox' # 'sandbox' for testing, 'live' for real environment
PAYPAL_CLIENT_ID = 'AUVEihBfbBCQzLxaTjNdhzV16yI-PvQEHDJblP6P4Ba1Fr5cu_CAZdO0-5IM'
PAYPAL_CLIENT_SECRET = 'EF5uIBClqoo--0oIhKeFtaa-ciCgL34WDkhyQbBslM7_MHZe2DHkNJTAM9pD'

Change the DOMAIN in settings.py to the domain of deployment environment

DOMAIN_NAME = '192.168.56.101:8000'

Change the e-mail part to your own e-mail service

# configure email host
EMAIL_HOST = 'smtp.qq.com' # SMTP server
EMAIL_PORT = 25 # SMTP port
EMAIL_HOST_USER = 'xxxxxxx@qq.com' # E-mail address
EMAIL_HOST_PASSWORD = 'xxxxxxxx'

Generator Script

In the Phimpme Android app, we modularized each feature as much as possible. We use a set of constants as function switches, and put all of them in Configuration.java. So on the generator side, we could use regular expressions to set the constants into true or false in order to enable or disable functions. The app name is in the strings.xml while the app logo is in drawable folder. The experimental version of generator hasn't support changing package name yet, but we will implement it in the future.

There are several steps for the generator script to generate an APK.

  1. Make a copy of the source code of the app
  2. Change the app name in strings.xml
  3. Change the logo in drawable folder
  4. Modify Configuration.java to enable or disable functions
  5. Compile the project through ./gradlew in the project folder.

Details of building the Android project in command line is available in the wiki of the Phimp.me Android app.