djangae | best way to run Django
kandi X-RAY | djangae Summary
kandi X-RAY | djangae Summary
The best way to run Django on Google Cloud. Djangae (djan-gee) is a Django app that allows you to run Django applications on the Google Cloud platform, including (if you want to) using Django's models with Google Cloud Datastore as the underlying database. :earth_africa: Website | :computer: GitLab | :closed_book: Docs | :busts_in_silhouette: Google Group.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Handler for oauth2 login
- Create a Google OAuth2 session
- Calculate the token s expiration time
- Authenticate the user
- Generate a unique username
- Validate an IAP JWT
- Find the atomic decorator
- Process a single shard iteration
- Define a callable object
- Load the user
- Authenticate a user
- Handler for local IAP login
- Generate shards for each shard
- Returns a new Secrets instance for the given secrets class
- Acquire a lock
- Return task location
- Generates a random string
- Get bucket name
- Wrap http url logging
- Decorator to remove middleware
- Return a new secrets instance
- A view decorator for views
- Handler for deferred requests
- Create required queues
- Decorator for view decorator
- Fetch a single page from the datastore
djangae Key Features
djangae Examples and Code Snippets
Community Discussions
Trending Discussions on djangae
QUESTION
I'm following the "Gauth authentication" portion of Djangae's documentation but I'm running into some unexpected behavior.
I've configured urls.py and settings.py as specified by the documentation (the current settings are mostly a result of using the Djangae Scaffold) but at no point are users prompted to authenticate using or link their Google account. I've tried un/setting DJANGAE_CREATE_UNKNOWN_USER
but this has no impact.
I've also tried running commands inspired by sitepackages/prod/djangae/contrib/gauth/tests.py in my local shell in order to verify that the back-end configuration is correctly configured and that users can actually be authenticated against AppEngineUserAPIBackend but that fails because my User model (djangae.contrib.gauth_datastore.models.GaeDatastoreUser) seems to be missing required attributes: AttributeError: 'GaeDatastoreUser' object has no attribute 'user_id'
.
So, am I misunderstanding how this is all supposed to work and must take some additional steps to get Google Sign-In working? Or have I (likely) misconfigured my application? (I'm happy to include genericized versions of my config, but as I said, they've come directly from Djangae Scaffold or the documentation.)
UPDATE: Interestingly, if I remove the --headless
flag from my Behavior suite config, I see the expected behavior. The browser (Chrome) is being redirected to https://accounts.google.com/Login?continue=http%3A%2F%2Flocalhost%3A8080%2F
Environment:
Djangae (0.9.11)
Django (1.11.19)
...ANSWER
Answered 2019-Mar-10 at 04:17It turns out that this is the expected behavior. In the local sandbox, users are prompted for an email address and (by default) a "user" is created for them and they are automatically logged in.
From App Engine's "Users Python API Overview" document:
Google accounts and the development server
The development server simulates the Google Accounts system using a dummy sign-in screen. When your application calls the Users API to get the URL for the sign-in screen, the API returns a special development server URL that prompts for an email address, but no password. You can type any email address into this prompt, and the app will behave as if you are signed in with an account with that address.
The dummy sign-in screen also includes a checkbox that indicates whether the dummy account is an administrator; that is, whether the account has the the Viewer, Editor, or Owner primitive role, or the App Engine App Admin predefined role. If you check this box, the app will behave as if you are signed in using an administrator account.
Similarly, the Users API returns a sign-out URL that cancels the dummy sign-in.
The unique ID for a User object in the development server is calculated from the email address. Two unique email addresses always represent two unique users in the development server.
Personally, I think this design is very flawed. I don't know what Google thinks about the Twelve Factor manifesto, but this behavior is a flagrant violation of article 10 (Dev/Prod Parity), which is summarized as "Keep development, staging, and production as similar as possible". I see no reason why the full auth/redirect flow wouldn't work in the local sandbox and, at the very least, users should be able to opt into it. (I would love to find out that this is an option.)
The most concerning part about this conditional behavior is that the user object's API is different, which is why I was seeing the error mentioned in my question ('GaeDatastoreUser' object has no attribute 'user_id'). The local user also has no nickname
method.
QUESTION
I am attempting to use djangae to serve static files only. In addition, I want to route all traffic to an index.html
. When I visit http://localhost:8000 I get a 500 error. When I visit http://localhost:8000/static/index.html, I get the correct file.
What am I doing wrong?
My urlpatterns
are as follows:
ANSWER
Answered 2019-Feb-13 at 18:42I have discovered a work around in this particular aspect. I moved the zone.tab
file to /
and edited my app.yaml to include this environment variable: PYTZ_TZDATADIR:
.
Still unsure why pytz needs to be called before a route is completed.
QUESTION
I'm using google app engine dev server for python running on mac os. The project I'm running is an appengine django project using djangae and django rest framework.
Everything in the project works fine, however as soon as a declare an import relating to the rest_framework I get an error regarding django.test.client
eventhough I'm not running any tests at the moment.
The import I try to do is 'from rest_framework.decoraters import api_view', as soon as I make this import or any other import relating to the rest framework.
This is the error I get with every import I make that involves the rest framework.
...ANSWER
Answered 2017-Mar-07 at 00:22If you run into import errors like this on app engine be sure to check your skip_files
in app.yaml.
For example:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install djangae
You can use djangae like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page