Sonata Admin - default_locale overwritten by fallback - sonata-admin

I'm trying to set Sonata pages locale to different value than my main application.
I have in my config.yml:
parameters:
locale: ru
framework:
translator: { fallbacks: ["%locale%"] }
sonata_translation:
locales: [en, de]
default_locale: en
I expected to have main page in Russian and admin pages in English, but all pages are in Russian.
How can I change default language of Sonata Admin pages?

As far as I know, there's no such parameter sonata_translation. Sonata Admin does not have any locale/translation configuration parameters: https://sonata-project.org/bundles/admin/master/doc/reference/configuration.html
Sonata uses your application/session locale. What you can/should do, is set locale for authorized user and user will have his session in preferred language.

Related

URL config Wagtail-pages in own Django project

I have set up my own Django-project. I have no own app’s installed. That’s for later. What I did was copying the ‘base’ and ‘blog’ app from the bakerydemo to my own project. These run fine, I can access the blog-pages and the admin-site from wagtail.
Only problem is the root url is now a blank-page (can’t add wagtail-field or anything). My wagtail homepage is now on ip-adress/home and it should be on ip-adress. This is my url-config:
from wagtail.admin import urls as wagtailadmin_urls
from wagtail import urls as wagtail_urls
from wagtail.documents import urls as wagtaildocs_urls
urlpatterns = [
path('admin/', admin.site.urls),
path('cms/', include(wagtailadmin_urls)),
path('documents/', include(wagtaildocs_urls)),
# path('pages/', include(wagtail_urls)),
path('', include(wagtail_urls)),
# path("test404/", TemplateView.as_view(template_name="404.html")>
# path("test500/", TemplateView.as_view(template_name="500.html")>
]
How can I change this? So my first wagtail page is on root-url and not on root-url/home/
Thnx in advanced.
Edit: found this on the wagtail docs, but don’t know how to apply:
Note that there’s one small difference when not using the Wagtail project template: Wagtail creates an initial homepage of the basic type Page, which does not include any content fields beyond the title. You’ll probably want to replace this with your own HomePage class - when you do so, ensure that you set up a site record (under Settings / Sites in the Wagtail admin) to point to the new homepage.
Instead of trying to move your wagtail page to root-url, you should create (or update) the default site so its root_page should be the page currently shown at /home/

Is it a way to use Next.js and WordPress pages under the same domain?

I have a Next.js site, but for the Landing page I would use a WordPress site. How is it possible?
In the next.config.js, you can set rewrites to work like a proxy with specific application paths. If you want only NextJS homepage router to another domain homepage, you can do this:
module.exports = {
rewrites() {
return [
{
source: "/",
destination: "http://mywordpresssite.com/",
},
];
},
};
Docs
Everything depends on the hosting server that you will use for hosting those website's. You can use one domain for both but you might be forced to use different route's.
Example:
Landing Page : www.example.com or www.example.com/home
Wordpress : www.example.com/news
Using apache for hosting, you can define a .htaccess that would redirect to the right application depending on the route.
I would suggest you to look into that, unless you can provide us more details about your hosting solution.
Edit:
You can check out the vercel configuration file to route something to specific subfolder/files.
More info here: https://vercel.com/docs/configuration#project/redirects

How can I use "login: required" on a Google App Engine app using a custom domain?

I have a Python GAE app on a custom domain. When I add login: required to any handler, the site redirects to the app's appspot.com domain instead of my custom domain. The functionality of the site isn't affected, and all handlers and routes continue to work as expected — just on the appspot.com domain instead.
Example snippet from the app.yaml below. mydomain.com works fine with the custom domain, mydomain.com/test and any other handlers redirect to the appspot.com domain after authentication (myapp.appspot.com/test).
- url: /
script: main.application
- url: /test
script: main.application
login: required
- url: /.*
script: main.application
login: required
Is this a configuration issue with how App Engine is handling the domain, or is this an issue with the redirect used by the login: required setting?
You need to set Authorized redirect URIs in your Developer Console (under API | Credentials) to your custom domain rather than the default appspot.com. So the requests coming from the custom domain would be 'called-back' to the custom domain as well.
Take a look on the attached screenshot on how this is configured for my application.
[]

AngularStack Facebook, Google+ and Twitter Authentication

I am making my first Web App using Generator Angular Fullstack. I went through the project initialization here: https://github.com/DaftMonk/generator-angular-fullstack
During initialization I set up oAuth for the following: Facebook, Google+, Twitter
I am using Openshift as well, and after initializing the project... I used the steps to add it to openshift. This included setting up environment variables for RHC for Facebook, Google+ and Twitter authentication. I added these as well.
However, with my new app... I cannot create a new account with Facebook, Google+ or Twitter.
When I create new account these are the errors I get:
Facebook:
Invalid App ID: id
Google+:
401. That’s an error.
Error: invalid_client
The OAuth client was not found.
Request Details
scope=https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email
response_type=code
redirect_uri=http://site.rhcloud.com/auth/google/callback
client_id=id
That’s all we know.
Twitter:
Internal Server Error
I haven't done much besides go through the tutorial so far. But I feel I missed something. Any help on this topic would be grea.t Thanks :)
Well, first of all you have to configure your clientIDs, clientSecrets and callBackURLs. These you will need to find on each oAuth provider's developer platform page. i.e. for Facebook this would be: https://developers.facebook.com/apps/
These can be placed in the local.env.js file (a sample is included, like this:
module.exports = {
DOMAIN: 'http://localhost:9000',
SESSION_SECRET: "xxxxxxxxxxxxx",
FACEBOOK_ID: 'xxxxxxx',
FACEBOOK_SECRET: 'xxxxxxx',
TWITTER_ID: 'xxxxxxx',
TWITTER_SECRET: 'xxxxxx',
GOOGLE_ID: 'xxxxxxx',
GOOGLE_SECRET: 'xxxxxxx',
.....
};
When deploying to Heroku don't forget to set the DOMAIN config variable with http/https prefix when using Google+ sign-in.
heroku config:set DOMAIN=http://<your app name>.herokuapp.com
Otherwise you will get a redirect_uri_mismatch. If this ends with an internal server error you probably need to enable the Google+ API in the Google developer console.
If you have obtained your provided ID and SECRET keys and you are still having difficulty with OpenShift as I did ... I found setting environment variables for the application did the trick for me.
Google for example:
rhc set-env -a GOOGLE_ID=
rhc set-env -a GOODLE_SECRET=
The module exports in local.env.js worked fine for me when I was developing locally but didn't when I pushed my app to OpenShift via grunt buildcontrol

AppEngine modules on custom domain

I plan to make a main website and a blog.
www.domain-name.com will be my main website and blog.domain-name.com
will be my blog.
I am able to achieve this on my appspot domain, but on my custom domain, it doesn't work.
https://blog-dot-domainname.appspot.com/ is showing the correct
webpage.
Currently blog.domain-name.com shows the exact same thing as www.domain-name.com.
Here's what I did:
dispatch.yaml file
dispatch:
# Default module serves the typical web resources and all static resources.
- url: "*/favicon.ico"
module: default
- url: "domain-name.com"
module: default
- url: "blog.domain-name.com/*"
module: blog
I also setup two custom domain names on the AppEngine settings:
CUSTOM DOMAIN NAMES domain-name.com blog.domain-name.com
I am using Namecheap and I setup the required CNAME alias for my bog subdomain.

Resources