web2py applications and version control systems

588 views
Skip to first unread message

Dave Warnock

unread,
Mar 17, 2011, 2:13:45 PM3/17/11
to web...@googlegroups.com
Hi,

Do people generally start version control at web2py/applications/myapp or at web2py?

If an application is to be deployed on gae then shouldn't some files in web2py be considered part of the project (index.yaml, app.yaml) and therefore under version control?

Yet I would prefer not to have the whole of web2py under version control so that I can more quickly move between web2py versions for testing & upgrading.

Just wondering what you do?

Dave

--
Dave Warnock: http://42.blogs.warnock.me.uk

pbreit

unread,
Mar 17, 2011, 2:50:12 PM3/17/11
to web...@googlegroups.com
I hg clone web2py and then set up a second repository for my app. So I can update web2py and my app independently.

howesc

unread,
Mar 17, 2011, 5:43:15 PM3/17/11
to web...@googlegroups.com
i have full web2py in source control for my clients.  this is so that at any time they can go back to a version of both my application and web2py that was running on their server.  it does make web2py upgrades a little trickier, but i think it is worth it from the code history/stability standpoint.

yes, as a GAE user you *need* to have app.yaml, index.yaml, and queue.yaml in your source control (right now they get overwritten on upgrade so you want them backed up).  most people also need to have routes.py in their source control.

when i want to test out new things from trunk, i have an hg repository of trunk and i just symlink the application that i want to test into that directory.  usually works without too much fuss.

christian

David Warnock

unread,
Mar 18, 2011, 3:31:59 PM3/18/11
to web...@googlegroups.com
Christian,

Thanks

yes, as a GAE user you *need* to have app.yaml, index.yaml, and queue.yaml in your source control (right now they get overwritten on upgrade so you want them backed up).  most people also need to have routes.py in their source control.

Ok. It seems that I need to have the web2py directory as my version control root rather than web2py/applications/myapp
 
when i want to test out new things from trunk, i have an hg repository of trunk and i just symlink the application that i want to test into that directory.  usually works without too much fuss.

And because I am using GAE I'll need to symlink the yaml files as well.

Thanks

Dave

David Warnock

unread,
Mar 18, 2011, 3:33:36 PM3/18/11
to web...@googlegroups.com
Hi,

I hg clone web2py and then set up a second repository for my app. So I can update web2py and my app independently.

I am using git, but no problem.

Which directory do you have as the root for the app repository?  web2py or web2py/applications/myapp

Thanks

Dave

--
Dave Warnock: http://42.blogs.warnock.me.uk

Jonathan Lundell

unread,
Mar 18, 2011, 3:35:49 PM3/18/11
to web...@googlegroups.com
On Mar 18, 2011, at 12:31 PM, David Warnock wrote:
Christian,

Thanks

yes, as a GAE user you *need* to have app.yaml, index.yaml, and queue.yaml in your source control (right now they get overwritten on upgrade so you want them backed up).  most people also need to have routes.py in their source control.

Ok. It seems that I need to have the web2py directory as my version control root rather than web2py/applications/myapp
 
when i want to test out new things from trunk, i have an hg repository of trunk and i just symlink the application that i want to test into that directory.  usually works without too much fuss.

And because I am using GAE I'll need to symlink the yaml files as well.


I keep my app.yaml, routes.py, etc in my applications private/ directory for version-control purposes, and either copy or link them to the web2py root for deployment.

pbreit

unread,
Mar 18, 2011, 3:39:07 PM3/18/11
to web...@googlegroups.com
For web2py, web2py is root. For my app, myapp is root.

Pulling from web2py repository will leave my app alone.

pbreit

unread,
Mar 18, 2011, 3:42:37 PM3/18/11
to web...@googlegroups.com
I do this as well. I have all my misc files in private and then in my setup and deploy Fabric scripts to "rm /var/web2py/routes.py; cp routes.py var/web2py/routes.py"

Linking actually sounds like a better way to go?

mattynoce

unread,
Mar 21, 2011, 8:22:54 PM3/21/11
to web...@googlegroups.com
i'm a n00b when it comes to version control, so i'm wondering if i can ask some specific questions. i've RTFM but i'm sure there are things i'm missing, so feel free to let me know if my questions are too n00bish. i'm using GAE and i'm on a mac, using the web2py source code (not the compiled mac app).

first, let's say i have your web2py folder and your apps inside it. i've set up mercurial on the web2py folder, and it works great. however, as discussed above, it becomes a big problem with upgrading web2py.

so i understand that some of you symlink the files in the web2py folder and keep them in /myapp/private. i get that in concept.

but what happens when you actually download the new web2py source code? do you download it and then use hg to import it? and do you cp the .yaml files out of /private as soon as you import the new web2py file? and how do you import the new source without overwriting /myapp -- do you move /myapp somewhere else, import web2py and then move it back?

i'd love to hear the actual logistics or see code files if anyone has them. i get the concepts of how it works but am having trouble figuring out how to handle the nuts and bolts.

thanks,

matt

pbreit

unread,
Mar 22, 2011, 12:47:15 AM3/22/11
to web...@googlegroups.com
First, you clone web2py from Google Code:

Then, to update web2py, you go in to the "web2py" directory and issue these two commands:
$ hg pull
$ hg update

This will not touch "applications/yourapp".

Then, my "init" app is a second mercurial repository that is totally independent from the web2py repository. You have two options here: you can either configure the copy on your hard drive to be the main repository or specify some other server to be the central repository. I use Bitbucket as my main repository. I "hg pull" to my hard drive and I also "hg pull" to my Ubuntu server. I'm not sure exactly how to deploy to GAE.

As a version control newbie as well, and on a Mac, I've had good times with MacHG. But it's also useful to learn the command line. The tutorial I like is hginit.com

pbreit

unread,
Mar 22, 2011, 12:54:21 AM3/22/11
to web...@googlegroups.com
I should have mentioned that while "hg pull" will pull down all of the most up-to-date files from the main repository, it will leave all the files in your locally directory unchanged. Nothing actually happens until you perform the "hg update". "hg update" by itself will then change all of the files in your directory to match the most current set of files. But you can also specify a changeset to update to. For example, "hg update R-1.94.1" or "hg update 8456baaddbc3" will make all the files in your "working" directory correspond only to that changeset.

howesc

unread,
Mar 22, 2011, 3:00:41 PM3/22/11
to web...@googlegroups.com
Just note that in this case you are using web2py *trunk*.  this is not acceptable (or recommended) for most production deployments.

that's why i download and unzip the specific release version i'm looking for.

cfh

pbreit

unread,
Mar 22, 2011, 5:32:41 PM3/22/11
to web...@googlegroups.com
As I mentioned, with Mercurial or any version control, you can specify the precise version that you want all of the files in the "working directory" to correspond to. In fact, after doing "hg pull", your files will be unchanged. It's not until you "hg update" that your files actually get updated. And you can specify what changeset or version tag you want to "hg update" to. For example "hg update R-1.94.1".

Also, many people do want to try out trunk to verify fixes. With version control, it's very easy to reliably switch back and forth.

Gregory Hellings

unread,
Mar 22, 2011, 5:21:02 PM3/22/11
to web2py-users
I was just getting ready to dump my newest project into VCS and was
wondering the same question. For me, since I'm not anywhere near
production yet, I am opting for just putting the application into VCS,
then I can use web2py's autoupdate feature. Again, I'm only using
this as a playground for putting ideas into code which might be used
later on down the line. So the version of web2py upgrading and
breaking things is not a concern for me.

If you're dealing with a real, life application for a client and
you're concerned about the extra files for GAE, I would start my VCS
at the base of web2py and only add my application and those files I
absolutely needed. The rest could be hg/bzr/git/svn ignore'd. Then
you can update just those files and track them, without being bothered
by changes to web2py. Again, since I'm only dealing with a sandbox
for my own amusement and learning at this time, I'm not really
concerned about tracking web2py's updates and matching it for
compatibility nor the ability to rollback.

--Greg
Reply all
Reply to author
Forward
0 new messages