Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reg. Django Admin admin panel #18

Closed
anush0247 opened this issue Feb 19, 2016 · 24 comments
Closed

Reg. Django Admin admin panel #18

anush0247 opened this issue Feb 19, 2016 · 24 comments

Comments

@anush0247
Copy link

when i tried to use django zappa for configure the django admin panel. session get logged out for every two subsequent clicks. I was unable to reach till adding a uses from django zappa based admin panel. I thought zappa cokkie getting expired.

@Miserlou
Copy link
Owner

Can you explain "adding a uses from django zappa based admin panel" a bit more? I don't understand.

@anush0247
Copy link
Author

I can able to login to the django admin panel. Through admin panel, i tried access users list, add tried add new user. I got the user addition form. while submitting the form. users gets logged out. Browser redirected to login page. Process get repeated on every attempt

@bjinwright
Copy link
Contributor

I can confirm this

@Miserlou
Copy link
Owner

Miserlou commented Apr 8, 2016

I'm 90% sure I know what this (and it's fixed in core) - but just to help me diagnose/reproduce - is the user created upon form submission?

Also - are you using the application on a domain, or on the raw APIGW URL?

@bjinwright
Copy link
Contributor

Are you sure it's not because the sessionid and csrftoken cookies aren't set?

@Miserlou
Copy link
Owner

Miserlou commented Apr 8, 2016

That's my current diagnosis. This is fixed in the Zappa-core middleware, which D-Z is not using - yet! See #52

Again, I hope that this will be fixed be E.O.D. If not, it should be soon, this is the current Zappa priority. Thanks for your patience.

@Miserlou
Copy link
Owner

Miserlou commented Apr 8, 2016

The other benefit of this is that it means that you won't have to add ZappaMiddleware to your Django config anymore.

@Miserlou
Copy link
Owner

Miserlou commented Apr 8, 2016

Confirming this for myself.. {"message": "Could not parse request body into json: Unexpected character ('-' (code 45)) in numeric value: expected digit (0-9) to follow minus sign, for valid numeric value\n at [Source: [B@64744c6; line: 1, column: 3]"}

@Miserlou
Copy link
Owner

Miserlou commented Apr 8, 2016

Weirdly enough, this may be because the django-admin defaults to "multipart/form-data".. investigating..

@bjinwright
Copy link
Contributor

Here is a screenshot of what parsed and unparsed session cookies I'm seeing. https://s3.amazonaws.com/ipoots-zappa/django-zappa-session.png

@bjinwright
Copy link
Contributor

Notice how immediately after first request after logging in the sessionid value is gone.

@bjinwright
Copy link
Contributor

This is the same behavior I noticed on the API Gateway version of the site.

@Miserlou
Copy link
Owner

Miserlou commented Apr 8, 2016

The cookie thing is fixed in core (and I think the head of D-Z master now), but the admin forms won't work until "multipart/form-data" forms work. Previously, this was impossible, but they made a change to API GW earlier this week that might allow it to work, but I need to investigate further. Stay tuned..

@Miserlou Miserlou closed this as completed Apr 8, 2016
@Miserlou Miserlou reopened this Apr 8, 2016
@bjinwright
Copy link
Contributor

Awesome

@Miserlou
Copy link
Owner

Miserlou commented Apr 8, 2016

Okay, this is gonna work! I'm not all the way there yet but it'll pretty sure it will based on what I have so far. This means file uploads will work through Zappa too now.

@Miserlou
Copy link
Owner

Miserlou commented Apr 8, 2016

Okay, I got it working!

@Miserlou
Copy link
Owner

Miserlou commented Apr 9, 2016

Something going on the the cookies now.. grrrrr..

@Miserlou
Copy link
Owner

Okay! This should now be fixed in 0.13.0. You will need to call the 'deploy' command again so that the template mappings update.

@bjinwright
Copy link
Contributor

I'm still seeing the logouts locally. Here is my pip freeze -l output.

base58==0.2.2
boto3==1.3.0
botocore==1.4.10
decorator==4.0.9
Django==1.9.5
django-zappa==0.13.0
docopt==0.6.2
docutils==0.12
futures==3.0.5
ipython==4.1.2
ipython-genutils==0.1.0
jmespath==0.9.0
lambda-packages==0.4.0
mysql-connector-python-rf==2.1.3
MySQL-python==1.2.5
path.py==8.2
pexpect==4.0.1
pickleshare==0.6
ptyprocess==0.5.1
python-dateutil==2.5.2
requests==2.9.1
simplegeneric==0.8.1
six==1.10.0
tqdm==4.4.0
traitlets==4.2.1
Unipath==1.1
Werkzeug==0.11.5
wheel==0.29.0
wsgi-request-logger==0.4.5
zappa==0.17.3

@Miserlou
Copy link
Owner

Locally?

You'll need to remove the DjangoZappaMiddleware from your middleware, and you'll need to re-'deploy' for the new templates.

@bjinwright
Copy link
Contributor

Update it works on Lambda. Except you can't update any records via admin. I suspect it is because there are only 4 parameters and to update records in admin you need at least 5. Realistically there might need to be 8. Where is the code that sets up the template for this? Maybe I can work on it.

@bjinwright
Copy link
Contributor

Screencast of what I'm seeing. https://youtu.be/fUrbDVLjekw

@Miserlou
Copy link
Owner

Ah, good catch!

You can update that with:

'parameter_depth': 10

which has a default of 5.

Again, this will require a different 'deploy'. I'm working on a 'redeploy' right now to avoid that.

I'll also increase the default.

@bjinwright
Copy link
Contributor

Ahh! Awesome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants