-1

Could I run my web app on Java and Python? I mean one portion of web service on Java and other part on Python?

Problem I am trying to solve is that on Java I can't find a solution for custom user authentication, however webapp2 for Python supports looks like custom user auth.

So I was thinking to write authentication portion on Python and rest of the app on Java.

Any ideas welcome, never used Google Api engine before.

Thanks!

EDIT

It seems like I can do modules approach, thanks for answers. I just wonder how would I use session in Java that I set using webapp2 in Phyton?

from example it uses auth.get_user_by_session():

def user_required(handler):
  """
    Decorator that checks if there's a user associated with the current session.
    Will also fail if there's no session present.
  """
  def check_login(self, *args, **kwargs):
    auth = self.auth
    if not auth.get_user_by_session():
      self.redirect(self.uri_for('login'), abort=True)
    else:
      return handler(self, *args, **kwargs)

  return check_login

just wonder how after successful login I can check user in JAVA.

antohoho
  • 950
  • 2
  • 17
  • 37
  • 1
    You need to look into modules my dear friend. They can be coded in any languages, without looking at the language of the application itself – Patrice Jun 05 '15 at 19:31
  • I looked at modules in Java and Python but seems like I should have two different apps. Because different runtime environment. Java is loading META-INF whily Python loading dispatch.yaml – antohoho Jun 05 '15 at 21:55

1 Answers1

1

Here you are, it is possible!

https://cloud.google.com/appengine/kb/java?csw=1#pythonandjava

This may be helpful:

http://www.jython.org

If you're looking to actually mix the languages on your own, that may be difficult.

I just wanted to add that the python version of App Engine is extremely straight forward and easy to learn. You may want to just take a day and learn that instead of mixing two languages.

Mmm Donuts
  • 9,551
  • 6
  • 27
  • 49
  • do not really understand - "version x of your app running Java, while version y is running Python." It feels like two different versions that do not run simultaneously. – antohoho Jun 05 '15 at 21:48
  • You can use modules to write one section in python and another section in Java (as mentioned in those comments up there ^) https://cloud.google.com/appengine/docs/python/modules/ – Mmm Donuts Jun 05 '15 at 22:15