if (process.env.NODE_ENV === 'development') {
module.exports.devtool = '#source-map'
module.exports.plugins = (module.exports.plugins || []).concat([
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"development"',
ENDPOINT: '"http://localhost:8000"'
}
})
])
}
if (process.env.NODE_ENV === 'production') {
module.exports.devtool = '#source-map'
module.exports.plugins = (module.exports.plugins || []).concat([
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"',
ENDPOINT: '"http://my_server_ip/"'
}
}),
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
compress: {
warnings: false
}
}),
new webpack.LoaderOptionsPlugin({
minimize: true
})
])
}
axios.defaults.baseURL = process.env.ENDPOINT
Его можно прямо после создания Profile делать. В том же if.
UserLevel.objects.create(user_id=instance.id, level_id=1, access=True)
Оно работает.@receiver(post_save, sender=User)
def create_user_profile(sender, instance, created, **kwargs):
if created:
UserProfile.objects.create(user=instance)
# this is new
UserLevel.objects.create(user_id=instance.id, level_id=1, access=True)
class UserLevelSerializer(serializers.ModelSerializer):
class Meta:
model = UserLevel
fields = '__all__'
list_select_related = ('level',)