Skip to content

Instantly share code, notes, and snippets.

@johntynan
Last active December 14, 2015 05:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johntynan/5032921 to your computer and use it in GitHub Desktop.
Save johntynan/5032921 to your computer and use it in GitHub Desktop.
Getting started with nprapps / app-template
cd ~/
mkdir webdev
cd webdev
mkdir nprapps
cd nprapps
git clone git@github.com:nprapps/app-template.git $NEW_PROJECT_NAME
cd $NEW_PROJECT_NAME
ls
#looks good!
# Edit app_config.py and update PROJECT_NAME, DEPLOYED_NAME, REPOSITORY_NAME any other relevant configuration details.
# Are these configuration values for flask? Check Flask documentation for why these values are important and how they are used.
# install nodejs
# if you are using ubuntu (or debian) use
sudo apt-get install nodejs npm
# install Node Packaged Modules
curl https://npmjs.org/install.sh | sh
# should this be run as root? Should I use:
sudo curl https://npmjs.org/install.sh | sh
# I received some error messages on this step
# important step
cd $NEW_PROJECT_NAME
# also install jst
# it would be good for me to understand what this is exactly
npm install less universal-jst
# if the version of python that you have installed does not have it installed already, install virtualenv and virtualenv wrapper
# I'll need to check to see if pip and virtualenv are shipping with python 2.7
# what version of python does this assume you are using?
sudo pip install virtualenv virtualenvwrapper
# for me, for some reason, this command is not found:
mkvirtualenv $NEW_PROJECT_NAME
# I used instead:
virtualenv --no-site-packages nprenv
source nprenv/bin/activate
# maybe I'm misunderstanding or mis using the command but do you really want to make a virtualenv WITHIN your app directory? will this be useful when deploying the app?
pip install Flask
cd nprenv/lib/python2.7/site-packages/
ls
cd flask
ls
cd ~/webdev/nprapps/$NEW_PROJECT_NAME
# install requirements for app
# you should still be in your app directory, but if not
cd ~/webdev/nprapps/$NEW_PROJECT_NAME
pip install -r requirements.txt
# what is this "workon $NEW_PROJECT_NAME" ?
# this returns an error message
workon nprquotes
workon: command not found
# I believe this is the equivalent of
source nprenv/bin/activate
# do you really want to activate your virtualenv at this point?
# I activated my virtualenv before I installed flask or ran thr command "pip install -r requirements.txt" this way,
# not everything was installed globally
# okay, run it!
python app.py
http://localhost:8000/
""" from within the nprqotes app directory this set of steps produce an error
rm -rf .git
git init
git add * .gitignore
git commit -am "Initial import from app-template."
git remote add origin git@github.com:nprapps/nprquotes.git
git push -u origin master
ERROR: Repository not found.
fatal: The remote end hung up unexpectedly
"""
Hi Brian!
First off... "This content goes to 12" Looks like I was able to set up the template through following the readme file almost entirely verbatim, so thank you!
Second, I wanted to offer some feedback as a person who a) is familiar with python web applications but not flask or some of the other frameworks used here and b) is someone who plans on going through the documentation step by step to hopefully offer both constructive feedback for you and gain clarification for myself as needed.
1) during the step describing how to install nodejs
it may be obvious to some, but you may want to point out that instead of using the install process for the mac you may want to also suggest this method (for those using ubuntu, for example):
sudo apt-get install nodejs npm
2) for the step describing how to install the Node Packaged Modules
curl https://npmjs.org/install.sh | sh
# should this be run as root? Should I use:
sudo curl https://npmjs.org/install.sh | sh
# I received some error messages on this step. I don't know how important this is, but we'll see if we need to come back to it.
3) regarding the use of the commands mkvirtualenv and workon, is there a recommended python version or python + certain installed modules that should be installed? I'm not sure if pip and virtualenv shipped with the version that I am using (2.7) but I know that virtualenvwrapper did not ship with my version. Also, even after installing virtualenvwrapper, mkvirtualenv and workon did not work for me, so I wound up using the commands that I was more familiar with:
virtualenv --no-site-packages $NEW_ENV_NAME
source $NEW_ENV_NAME/bin/activate
4) In following the readme file, I noticed that the command workon $NEW_PROJECT_NAME happens pretty late in the install process. Am I right in thinking that unless the virutalenv is "activated" (if I am using the term correctly) that the commands:
pip install Flask
and
pip install -r requirements.txt
will all be installed globally, under your system's python site-packages directory and not under the site packages directory within your virtualenv.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment